summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--package/network/ipv6/6relayd/Makefile11
-rw-r--r--package/network/ipv6/6relayd/files/6relayd.config17
-rw-r--r--package/network/ipv6/6relayd/files/6relayd.init46
3 files changed, 48 insertions, 26 deletions
diff --git a/package/network/ipv6/6relayd/Makefile b/package/network/ipv6/6relayd/Makefile
index 26fb6d069c..7e6d864728 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 0000000000..c5431d31b2
--- /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 a53bdb1977..f1c100b2e5 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
}