hnetd: add global config file
authorSteven Barth <steven@midlink.org>
Fri, 6 Jun 2014 15:03:57 +0000 (17:03 +0200)
committerSteven Barth <steven@midlink.org>
Fri, 6 Jun 2014 15:03:57 +0000 (17:03 +0200)
hnetd/Makefile
hnetd/files/hnet.config [new file with mode: 0644]
hnetd/files/hnetd.init

index 99cc221b4ed8f0f0316d1a115b6d60bf898290c7..a44651ed1a2eaef598315b944c98e27e15fec77a 100644 (file)
@@ -7,8 +7,8 @@
 include $(TOPDIR)/rules.mk
 
 PKG_NAME:=hnetd
-PKG_SOURCE_VERSION:=c6da40c19d0e550cd1e2dd1a459ef6cab9b15cae
-PKG_VERSION:=2014-06-02-$(PKG_SOURCE_VERSION)
+PKG_SOURCE_VERSION:=e60ce270f5a1ab01c6e262e1b9ee5cc20223b8c4
+PKG_VERSION:=2014-06-06-$(PKG_SOURCE_VERSION)
 PKG_RELEASE:=1
 
 PKG_SOURCE_PROTO:=git
@@ -65,6 +65,8 @@ define Package/hnetd/install
        ln -s hnetd $(1)/usr/sbin/hnet-call
        $(INSTALL_DIR) $(1)/etc/init.d
        $(INSTALL_BIN) ./files/hnetd.init $(1)/etc/init.d/hnetd
+       $(INSTALL_DIR) $(1)/etc/config
+       $(INSTALL_DATA) ./files/hnet.config $(1)/etc/config/hnet
        $(INSTALL_BIN) ./files/ohp-script $(1)/usr/sbin/hnetd-ohp-script
        $(INSTALL_BIN) ./files/pcp-script $(1)/usr/sbin/hnetd-pcp-script
        $(INSTALL_BIN) $(PKG_BUILD_DIR)/generic/hnetd-routing $(1)/usr/sbin/hnetd-routing
diff --git a/hnetd/files/hnet.config b/hnetd/files/hnet.config
new file mode 100644 (file)
index 0000000..e67e6eb
--- /dev/null
@@ -0,0 +1,8 @@
+config pa pa
+#      option ip4prefix 10.0.0.0/8
+#      option ulaprefix fd12:3456:789A::/48
+#      option persistent_store /etc/hnet-pa.store
+
+config sd sd
+#      option router_name openwrt
+#      option domain_name home.
index 6cdb4be078f10f7d546c61483122650be3516457..b24ba56c05c7de91b7f50ac6c846685bd9973d69 100644 (file)
@@ -16,6 +16,10 @@ PCP_SCRIPT=/usr/sbin/hnetd-pcp-script
 PCP_BINARY=/usr/sbin/minimalist-pcproxy
 
 start_service() {
+    . /lib/functions.sh
+    . /lib/functions/network.sh
+    config_load hnet
+
     mkdir -p $DNSMASQ_DIR
     procd_open_instance
     procd_set_param command /usr/sbin/hnetd
@@ -41,11 +45,24 @@ start_service() {
     fi
 
     # State file
-    procd_append_param command -s /tmp/hnetd.pa_state
+    config_get val pa persistent_store
+    procd_append_param command -s ${val:-/tmp/hnetd.pa_state}
 
     # Routing script
     procd_append_param command -r /usr/sbin/hnetd-routing
 
+    config_get val pa ip4prefix
+    [ -n "$val" ] && procd_append_param command --ip4prefix $val
+
+    config_get val pa ulaprefix
+    [ -n "$val" ] && procd_append_param command --ulaprefix $val
+
+    config_get val sd router_name
+    [ -n "$val" ] && procd_append_param command -n $val
+
+    config_get val sd domain_name
+    [ -n "$val" ] && procd_append_param command -m $val
+
     procd_set_param respawn
     procd_close_instance
 }