diff options
author | cyrus <cyrus@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-11-16 09:27:56 +0000 |
---|---|---|
committer | cyrus <cyrus@3c298f89-4303-0410-b956-a3cf2f4a3e73> | 2012-11-16 09:27:56 +0000 |
commit | 9a47c045f25ecbb0139681996635aa3a85ac6fc9 (patch) | |
tree | 66c89927f71bdb112c7430944241924905e3f9b8 /package | |
parent | 4474c34f386da98a74b68795025985f5de5cc999 (diff) |
6relayd: various updates & fixes
- Add RD- and DHCPv6-server functionality
- Rework configuration and add example UCI file
- Fix various bugs and be more RFC compliant
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@34204 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r-- | package/network/ipv6/6relayd/Makefile | 11 | ||||
-rw-r--r-- | package/network/ipv6/6relayd/files/6relayd.config | 17 | ||||
-rw-r--r-- | package/network/ipv6/6relayd/files/6relayd.init | 46 |
3 files changed, 48 insertions, 26 deletions
diff --git a/package/network/ipv6/6relayd/Makefile b/package/network/ipv6/6relayd/Makefile index 26fb6d069..7e6d86472 100644 --- a/package/network/ipv6/6relayd/Makefile +++ b/package/network/ipv6/6relayd/Makefile @@ -8,14 +8,14 @@ include $(TOPDIR)/rules.mk PKG_NAME:=6relayd -PKG_VERSION:=2012-11-01 +PKG_VERSION:=2012-11-16 PKG_RELEASE=$(PKG_SOURCE_VERSION) PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION) PKG_SOURCE_URL:=git://nbd.name/6relayd.git PKG_SOURCE_PROTO:=git -PKG_SOURCE_VERSION:=3f8db4e75d6ac98ea290e0b52e4e2cff91bcee8c +PKG_SOURCE_VERSION:=f0fec4df02e3310de134e46e9826dbeedb86119a PKG_MAINTAINER:=Steven Barth <steven@midlink.org> @@ -25,7 +25,7 @@ include $(INCLUDE_DIR)/cmake.mk define Package/6relayd SECTION:=ipv6 CATEGORY:=IPv6 - TITLE:=IPv6-Relay (RD-, DHCPv6- & NDP-Proxy) + TITLE:=IPv6-Relay and Server (RD-, DHCPv6- & NDP-Proxy) DEPENDS:=+kmod-ipv6 endef @@ -34,6 +34,9 @@ define Package/6relayd/description discovery, neighbor discovery and DHCPv6 so that clients on routed (non- bridged) interfaces can use the public address prefix, DHCPv6 and DNS-service of a master interface. This is useful to avoid NAT in chained IPv6-routers. + + It can also be used as a lightweight router advertisement daemon and provide + stateless DHCPv6 service where size matters. endef define Package/6relayd/install @@ -41,6 +44,8 @@ define Package/6relayd/install $(INSTALL_BIN) $(PKG_BUILD_DIR)/6relayd $(1)/usr/sbin/ $(INSTALL_DIR) $(1)/etc/hotplug.d/iface $(INSTALL_DATA) ./files/6relayd.hotplug $(1)/etc/hotplug.d/iface/30-6relay + $(INSTALL_DIR) $(1)/etc/config + $(INSTALL_DATA) ./files/6relayd.config $(1)/etc/config/6relayd $(INSTALL_DIR) $(1)/etc/init.d $(INSTALL_BIN) ./files/6relayd.init $(1)/etc/init.d/6relayd endef diff --git a/package/network/ipv6/6relayd/files/6relayd.config b/package/network/ipv6/6relayd/files/6relayd.config new file mode 100644 index 000000000..c5431d31b --- /dev/null +++ b/package/network/ipv6/6relayd/files/6relayd.config @@ -0,0 +1,17 @@ +# Example #1: Create a relay for several networks in proxy mode +# This can be used to proxy Router Discovery, DHCPv6 and NDP. + +#config relay +# option network 'wan lan' +# option rd 'relay' +# option dhcpv6 'relay' +# option ndp 'relay' + + +# Example #2: Provide Router Discovery and stateless DHCPv6 in server mode +# This can be used as a small radvd and stateless DHCPv6-server replacement. + +#config server +# option network 'lan' +# option rd 'server' +# option dhcpv6 'server' diff --git a/package/network/ipv6/6relayd/files/6relayd.init b/package/network/ipv6/6relayd/files/6relayd.init index a53bdb197..f1c100b2e 100644 --- a/package/network/ipv6/6relayd/files/6relayd.init +++ b/package/network/ipv6/6relayd/files/6relayd.init @@ -18,13 +18,10 @@ resolve_network() { start_6relayd() { local cfg="$1" - - local args="-S -l" + local mode="$2" + local args="-s -l" local ifaces="" - config_get proto "$cfg" proto - [[ "$proto" == 6relay ]] || return 0 - SERVICE_DAEMONIZE=1 SERVICE_WRITE_PID=1 SERVICE_PID_FILE="/var/run/6relayd-$cfg.pid" @@ -50,28 +47,30 @@ start_6relayd() { resolve_ifname "$ifn" done - local forward_rd # = 1 - config_get_bool forward_rd "$cfg" forward_rd 1 - [ $forward_rd -eq 1 ] && append args "-R" - - local forward_dhcpv6 # = 1 - local forward_dhcpv6_mode # = relay - config_get_bool forward_dhcpv6 "$cfg" forward_dhcpv6 1 - config_get forward_dhcpv6_mode "$cfg" forward_dhcpv6_mode - [ $forward_dhcpv6 -eq 1 ] && append args "-D$forward_dhcpv6_mode" + local rd + config_get rd "$cfg" rd + [ -n "$rd" ] && append args "-R$rd" - local forward_ndp # = 1 - config_get_bool forward_ndp "$cfg" forward_ndp 1 - [ $forward_ndp -eq 1 ] && append args "-N" + local dhcpv6 + config_get dhcpv6 "$cfg" dhcpv6 + [ -n "$dhcpv6" ] && append args "-D$dhcpv6" - local configure_routes # = 1 - config_get_bool configure_routes "$cfg" configure_routes 1 - [ $configure_routes -eq 1 ] && append args "-r" + local ndp + config_get ndp "$cfg" ndp + [ "$ndp" == "relay" ] && append args "-N -r" - local always_rewrite_dns # = 0 + local always_rewrite_dns config_get_bool always_rewrite_dns "$cfg" always_rewrite_dns 0 [ $always_rewrite_dns -eq 1 ] && append args "-n" + # In server mode the first interface needs to be passed twice + [ "$mode" == "server" ] && { + for iface in $ifaces; do + ifaces="$iface $ifaces" + break + done + } + service_start /usr/sbin/6relayd $args $ifaces } @@ -85,6 +84,7 @@ stop() { start() { include /lib/network - config_load network - config_foreach start_6relayd interface + config_load 6relayd + config_foreach start_6relayd relay relay + config_foreach start_6relayd server server } |