olsrd: splitting IPv6/4 configuration and start scripts
authorAlessio Caiazza <nolith@abisso.org>
Wed, 28 May 2014 10:28:14 +0000 (12:28 +0200)
committerAlessio Caiazza <nolith@abisso.org>
Wed, 28 May 2014 13:09:07 +0000 (15:09 +0200)
As mentioned by zioproto[1] 6and4 is badly broken, this patch will
use 2 different configuration and init scripts.

[1] https://github.com/openwrt-routing/packages/issues/16#issuecomment-32892327

olsrd/Makefile
olsrd/files/olsrd.config [deleted file]
olsrd/files/olsrd.init
olsrd/files/olsrd4.config [new file with mode: 0644]
olsrd/files/olsrd4.init [new file with mode: 0644]
olsrd/files/olsrd6.config [new file with mode: 0644]
olsrd/files/olsrd6.init [new file with mode: 0644]

index 2faadd82b975bae2eb99d39b22c69c37692ac32e..5004b5f976ab9cb831107327d9ecac5379d3f291 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=olsrd
 PKG_VERSION:=0.6.6.1
-PKG_RELEASE:=3
+PKG_RELEASE:=4
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
 PKG_SOURCE_URL:=http://www.olsr.org/releases/0.6
@@ -37,7 +37,8 @@ define Package/olsrd
 endef
 
 define Package/olsrd/conffiles
-/etc/config/olsrd
+/etc/config/olsrd4
+/etc/config/olsrd6
 endef
 
 define Package/olsrd-mod-arprefresh
@@ -169,12 +170,16 @@ define Build/Compile
 endef
 
 define Package/olsrd/install
+       $(INSTALL_DIR) $(1)/lib/functions
+       $(INSTALL_DATA) ./files/olsrd.init $(1)/lib/functions/olsrd.sh
        $(INSTALL_DIR) $(1)/etc/config
-       $(INSTALL_DATA) ./files/olsrd.config $(1)/etc/config/olsrd
+       $(INSTALL_DATA) ./files/olsrd4.config $(1)/etc/config/olsrd4
+       $(INSTALL_DATA) ./files/olsrd6.config $(1)/etc/config/olsrd6
        $(INSTALL_DIR) $(1)/usr/sbin
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/olsrd $(1)/usr/sbin/
        $(INSTALL_DIR) $(1)/etc/init.d
-       $(INSTALL_BIN) ./files/olsrd.init $(1)/etc/init.d/olsrd
+       $(INSTALL_BIN) ./files/olsrd4.init $(1)/etc/init.d/olsrd4
+       $(INSTALL_BIN) ./files/olsrd6.init $(1)/etc/init.d/olsrd6
        $(INSTALL_DIR) $(1)/etc/hotplug.d/iface
        $(INSTALL_BIN) ./files/olsrd.hotplug.sh $(1)/etc/hotplug.d/iface/50-olsrd
 endef
diff --git a/olsrd/files/olsrd.config b/olsrd/files/olsrd.config
deleted file mode 100644 (file)
index 9a19eb9..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-config olsrd
-       # uncomment the following line to use a custom config file instead:
-       #option config_file '/etc/olsrd.conf'
-
-       option IpVersion '4'
-
-config LoadPlugin
-       option library 'olsrd_arprefresh.so.0.1'
-
-config LoadPlugin
-       option library 'olsrd_dyn_gw.so.0.5'
-
-config LoadPlugin
-       option library 'olsrd_httpinfo.so.0.1'
-       option port '1978'
-       list Net '0.0.0.0 0.0.0.0'
-
-config LoadPlugin
-       option library 'olsrd_nameservice.so.0.3'
-
-config LoadPlugin
-       option library 'olsrd_txtinfo.so.0.1'
-       option accept '0.0.0.0'
-
-config Interface
-       list interface 'wlan'
index c8f1df566c1b1b975fbf717d3d6f615c3444709b..d0c4e0035262db8c0250e8425fd6a0749ab6dc80 100644 (file)
@@ -6,10 +6,6 @@ START=65
 SERVICE_DAEMONIZE=1
 SERVICE_WRITE_PID=1
 
-CONF=/var/etc/olsrd.conf
-PID=/var/run/olsrd.pid
-PID6=/var/run/olsrd.ipv6.pid
-
 OLSRD_OLSRD_SCHEMA='ignore:internal config_file:internal DebugLevel=0 AllowNoInt=yes'
 OLSRD_IPCCONNECT_SCHEMA='ignore:internal Host:list Net:list2'
 OLSRD_LOADPLUGIN_SCHEMA='ignore:internal library:internal Host4:list Net4:list2 Host:list Net:list2 Host6:list Net6:list2 Ping:list redistribute:list NonOlsrIf:list name:list lat lon latlon_infile HNA:list2 hosts:list2'
@@ -766,7 +762,7 @@ start() {
 
        . /lib/functions/network.sh
 
-       config_load olsrd
+       config_load $UCI_CONF_NAME
        reset_cb
 
        OLSRD_CONFIG_FILE=
@@ -774,9 +770,9 @@ start() {
 
        if [ -z "$OLSRD_CONFIG_FILE" ]; then
                mkdir -p -- /var/etc/
-               olsrd_write_config > /var/etc/olsrd.conf
+               olsrd_write_config > /var/etc/$UCI_CONF_NAME.conf
                if [ "$INTERFACES_COUNT" -gt 0 -a "$OLSRD_COUNT" -gt 0 ]; then
-                       OLSRD_CONFIG_FILE=/var/etc/olsrd.conf
+                       OLSRD_CONFIG_FILE=/var/etc/$UCI_CONF_NAME.conf
                fi
        fi
 
@@ -837,7 +833,4 @@ start() {
 stop() {
        SERVICE_PID_FILE="$PID"
        service_stop /usr/sbin/olsrd
-
-       SERVICE_PID_FILE="$PID6"
-       service_stop /usr/sbin/olsrd
 }
diff --git a/olsrd/files/olsrd4.config b/olsrd/files/olsrd4.config
new file mode 100644 (file)
index 0000000..9a19eb9
--- /dev/null
@@ -0,0 +1,26 @@
+config olsrd
+       # uncomment the following line to use a custom config file instead:
+       #option config_file '/etc/olsrd.conf'
+
+       option IpVersion '4'
+
+config LoadPlugin
+       option library 'olsrd_arprefresh.so.0.1'
+
+config LoadPlugin
+       option library 'olsrd_dyn_gw.so.0.5'
+
+config LoadPlugin
+       option library 'olsrd_httpinfo.so.0.1'
+       option port '1978'
+       list Net '0.0.0.0 0.0.0.0'
+
+config LoadPlugin
+       option library 'olsrd_nameservice.so.0.3'
+
+config LoadPlugin
+       option library 'olsrd_txtinfo.so.0.1'
+       option accept '0.0.0.0'
+
+config Interface
+       list interface 'wlan'
diff --git a/olsrd/files/olsrd4.init b/olsrd/files/olsrd4.init
new file mode 100644 (file)
index 0000000..eb13eee
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2013 OpenWrt.org
+
+. /lib/functions/olsrd.sh
+
+START=65
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+CONF=/var/etc/olsrd4.conf
+PID=/var/run/olsrd4.pid
+
+UCI_CONF_NAME=olsrd4
diff --git a/olsrd/files/olsrd6.config b/olsrd/files/olsrd6.config
new file mode 100644 (file)
index 0000000..a71a2dc
--- /dev/null
@@ -0,0 +1,13 @@
+config olsrd
+       # uncomment the following line to use a custom config file instead:
+       #option config_file '/etc/olsrd6.conf'
+
+       option IpVersion '6'
+
+config LoadPlugin
+       option library 'olsrd_txtinfo.so.0.1'
+       option accept '::'
+       option port '2007'
+
+config Interface
+       list interface 'wlan'
diff --git a/olsrd/files/olsrd6.init b/olsrd/files/olsrd6.init
new file mode 100644 (file)
index 0000000..71d5dbd
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh /etc/rc.common
+# Copyright (C) 2008-2013 OpenWrt.org
+
+. /lib/functions/olsrd.sh
+
+START=65
+
+SERVICE_DAEMONIZE=1
+SERVICE_WRITE_PID=1
+
+CONF=/var/etc/olsrd6.conf
+PID=/var/run/olsrd6.pid
+
+UCI_CONF_NAME=olsrd6