summaryrefslogtreecommitdiff
path: root/package/network/ipv6/6relayd/files
diff options
context:
space:
mode:
authorcyrus <cyrus@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-11-16 09:27:56 +0000
committercyrus <cyrus@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-11-16 09:27:56 +0000
commit9a47c045f25ecbb0139681996635aa3a85ac6fc9 (patch)
tree66c89927f71bdb112c7430944241924905e3f9b8 /package/network/ipv6/6relayd/files
parent4474c34f386da98a74b68795025985f5de5cc999 (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/network/ipv6/6relayd/files')
-rw-r--r--package/network/ipv6/6relayd/files/6relayd.config17
-rw-r--r--package/network/ipv6/6relayd/files/6relayd.init46
2 files changed, 40 insertions, 23 deletions
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
}