diff options
author | Steven Barth <steven@midlink.org> | 2013-05-13 17:12:30 +0000 |
---|---|---|
committer | Steven Barth <steven@midlink.org> | 2013-05-13 17:12:30 +0000 |
commit | 683810fbfffc64f0f517d0689e596b531c035e26 (patch) | |
tree | d2df7a1c46988361c7c724c19818c8a82037ccce /package/network/config | |
parent | 1f64838bbc16141221def1efc673c29ce0b145a3 (diff) | |
download | upstream-683810fbfffc64f0f517d0689e596b531c035e26.tar.gz upstream-683810fbfffc64f0f517d0689e596b531c035e26.tar.bz2 upstream-683810fbfffc64f0f517d0689e596b531c035e26.zip |
netifd: added support for setting up 6rd from DHCP
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@36626 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/network/config')
-rwxr-xr-x | package/network/config/netifd/files/lib/netifd/dhcp.script | 24 | ||||
-rwxr-xr-x | package/network/config/netifd/files/lib/netifd/proto/dhcp.sh | 6 |
2 files changed, 28 insertions, 2 deletions
diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script index d26db0f4d1..b365a53528 100755 --- a/package/network/config/netifd/files/lib/netifd/dhcp.script +++ b/package/network/config/netifd/files/lib/netifd/dhcp.script @@ -35,6 +35,30 @@ setup_interface () { done proto_send_update "$INTERFACE" + if [ -n "$IFACE6RD" -a -n "$ip6rd" ]; then + local v4mask="${ip6rd%% *}" + ip6rd="${ip6rd#* }" + local ip6rdprefixlen="${ip6rd%% *}" + ip6rd="${ip6rd#* }" + local ip6rdprefix="${ip6rd%% *}" + ip6rd="${ip6rd#* }" + local ip6rdbr="${ip6rd%% *}" + +uci -q batch <<-EOF >/dev/null +set network.$IFACE6RD.proto=6rd +set network.$IFACE6RD.auto=0 +set network.$IFACE6RD.peeraddr=$ip6rdbr +set network.$IFACE6RD.ip4prefixlen=$v4mask +set network.$IFACE6RD.ip6prefix=$ip6rdprefix +set network.$IFCAE6RD.ip6prefixlen=$ip6rdprefixlen +commit network +EOF + + ifdown "$IFACE6RD" + /etc/init.d/network reload + ifup "$IFACE6RD" + fi + # TODO # [ -n "$ntpsrv" ] && change_state network "$ifc" lease_ntpsrv "$ntpsrv" # [ -n "$timesvr" ] && change_state network "$ifc" lease_timesrv "$timesvr" diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh index 38308785df..a270c681d7 100755 --- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh +++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh @@ -12,14 +12,15 @@ proto_dhcp_init_config() { proto_config_add_string "vendorid" proto_config_add_boolean "broadcast" proto_config_add_string "reqopts" + proto_config_add_string "iface6rd" } proto_dhcp_setup() { local config="$1" local iface="$2" - local ipaddr hostname clientid vendorid broadcast reqopts - json_get_vars ipaddr hostname clientid vendorid broadcast reqopts + local ipaddr hostname clientid vendorid broadcast reqopts iface6rd + json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd local opt dhcpopts for opt in $reqopts; do @@ -28,6 +29,7 @@ proto_dhcp_setup() { [ "$broadcast" = 1 ] && broadcast="-B" || broadcast= [ -n "$clientid" ] && clientid="-x 0x3d:${clientid//:/}" || clientid="-C" + [ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd" proto_export "INTERFACE=$config" proto_run_command "$config" udhcpc \ |