aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorSteven Barth <cyrus@openwrt.org>2013-02-01 12:28:39 +0000
committerSteven Barth <cyrus@openwrt.org>2013-02-01 12:28:39 +0000
commit9a62439c282490622d5817f3464b1870e9f1b87c (patch)
tree99fd5cae4bbbe2d335330c7031a7b7daa6f5f4a8 /package
parenta3368da479b7b830867512bdf0fb4a4d5c8d0400 (diff)
downloadupstream-9a62439c282490622d5817f3464b1870e9f1b87c.tar.gz
upstream-9a62439c282490622d5817f3464b1870e9f1b87c.tar.bz2
upstream-9a62439c282490622d5817f3464b1870e9f1b87c.zip
odhcp6c: switch to userspace RA-handling and offload address assignment to netifd
SVN-Revision: 35419
Diffstat (limited to 'package')
-rw-r--r--package/network/ipv6/odhcp6c/Makefile4
-rwxr-xr-xpackage/network/ipv6/odhcp6c/files/dhcpv6.script73
-rwxr-xr-xpackage/network/ipv6/odhcp6c/files/dhcpv6.sh7
3 files changed, 54 insertions, 30 deletions
diff --git a/package/network/ipv6/odhcp6c/Makefile b/package/network/ipv6/odhcp6c/Makefile
index 6ac2c67f72..7b616c9c91 100644
--- a/package/network/ipv6/odhcp6c/Makefile
+++ b/package/network/ipv6/odhcp6c/Makefile
@@ -8,14 +8,14 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=odhcp6c
-PKG_VERSION:=2013-01-29
+PKG_VERSION:=2013-02-01
PKG_RELEASE=$(PKG_SOURCE_VERSION)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_URL:=git://github.com/sbyx/odhcp6c.git
PKG_SOURCE_PROTO:=git
-PKG_SOURCE_VERSION:=770741e98f2569ec0b00251ba9bf17a92e89221e
+PKG_SOURCE_VERSION:=7b3e29a4ff20f1b1e91fa65b5a0631462dbee06d
PKG_MAINTAINER:=Steven Barth <steven@midlink.org>
include $(INCLUDE_DIR)/package.mk
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script
index be91d16422..1f019353d5 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.script
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script
@@ -3,33 +3,19 @@
. /lib/functions.sh
. /lib/netifd/netifd-proto.sh
-ipv6_conf() {
- echo "$3" > "/proc/sys/net/ipv6/conf/$1/$2"
-}
-
-prepare_interface() {
- local device="$1"
- ipv6_conf "$device" accept_ra 2
-
- # Send RS
- if [ -x /usr/sbin/6relayd ]; then
- sleep 1
- /usr/sbin/6relayd -s "$device"
- sleep 4
- /usr/sbin/6relayd -s "$device"
- fi
-
-}
-
-cleanup_interface() {
- local device="$1"
- ipv6_conf "$device" accept_ra 0
-}
-
setup_interface () {
local device="$1"
proto_init_update "*" 1
+ # Merge RA-DNS
+ for radns in $RA_DNS; do
+ local duplicate=0
+ for dns in $RDNSS; do
+ [ "$radns" = "$dns" ] && duplicate=1
+ done
+ [ "$duplicate" = 0 ] && RDNSS="$RDNSS $radns"
+ done
+
for dns in $RDNSS; do
proto_add_dns_server "$dns"
done
@@ -42,6 +28,43 @@ setup_interface () {
proto_add_ipv6_prefix "$prefix"
done
+ # Merge addresses
+ for entry in $RA_ADDRESSES; do
+ local duplicate=0
+ local addr="${entry%%/*}"
+ for dentry in $ADDRESSES; do
+ local daddr="${dentry%%/*}"
+ [ "$addr" = "$daddr" ] && duplicate=1
+ done
+ [ "$duplicate" = "0" ] && ADDRESSES="$ADDRESSES $entry"
+ done
+
+ for entry in $ADDRESSES; do
+ local addr="${entry%%/*}"
+ entry="${entry#*/}"
+ local mask="${entry%%,*}"
+ entry="${entry#*,}"
+ local preferred="${entry%%,*}"
+ entry="${entry#*,}"
+ local valid="${entry%%,*}"
+
+ proto_add_ipv6_address "$addr" "$mask" "$preferred" "$valid" 1
+ done
+
+ for entry in $RA_ROUTES; do
+ local addr="${entry%%/*}"
+ entry="${entry#*/}"
+ local mask="${entry%%,*}"
+ entry="${entry#*,}"
+ local gw="${entry%%,*}"
+ entry="${entry#*,}"
+ local valid="${entry%%,*}"
+ entry="${entry#*,}"
+ local metric="${entry%%,*}"
+
+ proto_add_ipv6_route "$addr" "$mask" "$gw" "$metric" "$valid"
+ done
+
proto_send_update "$INTERFACE"
# TODO: $SNTP_IP $SIP_IP $SNTP_FQDN $SIP_DOMAIN
@@ -53,12 +76,10 @@ teardown_interface() {
}
case "$2" in
- informed|bound|updated|rebound)
+ informed|bound|updated|rebound|ra-updated)
setup_interface "$1"
- prepare_interface "$1"
;;
started|stopped|unbound)
- cleanup_interface "$1"
teardown_interface "$1"
;;
esac
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index 14b6fb63b4..99867cd99d 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -9,14 +9,15 @@ proto_dhcpv6_init_config() {
proto_config_add_string "reqprefix"
proto_config_add_string "clientid"
proto_config_add_string "reqopts"
+ proto_config_add_string "allow_slaaconly"
}
proto_dhcpv6_setup() {
local config="$1"
local iface="$2"
- local reqaddress reqprefix clientid reqopts
- json_get_vars reqaddress reqprefix clientid reqopts
+ local reqaddress reqprefix clientid reqopts allow_slaaconly
+ json_get_vars reqaddress reqprefix clientid reqopts allow_slaaconly
# Configure
@@ -28,6 +29,8 @@ proto_dhcpv6_setup() {
[ -n "$clientid" ] && append opts "-c$clientid"
+ [ "$allow_slaaconly" = "1" ] && append opts "-S"
+
for opt in $reqopts; do
append opts "-r$opt"
done