From ddcdb773b32a7a5e1427542a4b39757b6823edc3 Mon Sep 17 00:00:00 2001 From: Steven Barth Date: Fri, 6 Jun 2014 17:03:57 +0200 Subject: [PATCH] hnetd: add global config file --- hnetd/Makefile | 6 ++++-- hnetd/files/hnet.config | 8 ++++++++ hnetd/files/hnetd.init | 19 ++++++++++++++++++- 3 files changed, 30 insertions(+), 3 deletions(-) create mode 100644 hnetd/files/hnet.config diff --git a/hnetd/Makefile b/hnetd/Makefile index 99cc221..a44651e 100644 --- a/hnetd/Makefile +++ b/hnetd/Makefile @@ -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 index 0000000..e67e6eb --- /dev/null +++ b/hnetd/files/hnet.config @@ -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. diff --git a/hnetd/files/hnetd.init b/hnetd/files/hnetd.init index 6cdb4be..b24ba56 100644 --- a/hnetd/files/hnetd.init +++ b/hnetd/files/hnetd.init @@ -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 }