aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/ipv6
diff options
context:
space:
mode:
authorSteven Barth <cyrus@openwrt.org>2014-07-24 14:17:41 +0000
committerSteven Barth <cyrus@openwrt.org>2014-07-24 14:17:41 +0000
commit9231df566517da7cc679b5a09832e9eb84d31ef3 (patch)
tree7fa2a14ad9ce97542dd981e945753458746f51c0 /package/network/ipv6
parenta8486aeff346df74a19b8e73f137d0b3c985dd89 (diff)
downloadupstream-9231df566517da7cc679b5a09832e9eb84d31ef3.tar.gz
upstream-9231df566517da7cc679b5a09832e9eb84d31ef3.tar.bz2
upstream-9231df566517da7cc679b5a09832e9eb84d31ef3.zip
softwires: redesign dhcp(v6) provisioning
Signed-off-by: Steven Barth <steven@midlink.org> SVN-Revision: 41823
Diffstat (limited to 'package/network/ipv6')
-rwxr-xr-xpackage/network/ipv6/odhcp6c/files/dhcpv6.script39
-rwxr-xr-xpackage/network/ipv6/odhcp6c/files/dhcpv6.sh6
2 files changed, 26 insertions, 19 deletions
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.script b/package/network/ipv6/odhcp6c/files/dhcpv6.script
index 42c67c19c2..8c1ba18f49 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.script
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.script
@@ -78,38 +78,29 @@ setup_interface () {
proto_add_data
[ -n "$CER" ] && json_add_string cer "$CER"
[ -n "$PASSTHRU" ] && json_add_string passthru "$PASSTHRU"
+ [ -n "$ZONE" ] && json_add_string zone "$ZONE"
proto_close_data
proto_send_update "$INTERFACE"
- if [ -n "$AFTR_IP " -a -n "$IFACE_DSLITE" ]; then
- json_init
- json_add_string name "$IFACE_DSLITE"
- json_add_string ifname "@$INTERFACE"
- json_add_string proto "dslite"
- json_add_string peeraddr "$AFTR_IP"
- json_add_string tunlink "$INTERFACE"
- [ -n "$ZONE_DSLITE" ] && json_add_string zone "$ZONE_DSLITE"
- [ -n "$IFACE_DSLITE_DELEGATE" ] && json_add_boolean delegate "$IFACE_DSLITE_DELEGATE"
- json_close_object
- ubus call network add_dynamic "$(json_dump)"
- fi
-
MAPTYPE=""
MAPRULE=""
- if [ -n "$MAPE" ]; then
+ if [ -n "$MAPE" -a -f /lib/netifd/proto/map.sh ]; then
MAPTYPE="map-e"
MAPRULE="$MAPE"
- elif [ -n "$MAPT" ]; then
+ elif [ -n "$MAPT" -a -f /lib/netifd/proto/map.sh -a -f /proc/net/nat46/control ]; then
MAPTYPE="map-t"
MAPRULE="$MAPT"
- elif [ -n "$LW4O6" ]; then
+ elif [ -n "$LW4O6" -a -f /lib/netifd/proto/map.sh ]; then
MAPTYPE="lw4o6"
MAPRULE="$LW4O6"
fi
- if [ -n "$IFACE_MAP" -a -n "$MAPTYPE" -a -n "$MAPRULE" ]; then
+ [ -n "$ZONE" ] || ZONE=$(fw3 network $INTERFACE)
+
+ if [ "$IFACE_MAP" != 0 -a -n "$MAPTYPE" -a -n "$MAPRULE" ]; then
+ [ -z "$IFACE_MAP" -o "$IFACE_MAP" = 1 ] && IFACE_MAP=${INTERFACE}_map
json_init
json_add_string name "$IFACE_MAP"
json_add_string ifname "@$INTERFACE"
@@ -117,10 +108,24 @@ setup_interface () {
json_add_string type "$MAPTYPE"
json_add_string rule "$MAPRULE"
json_add_string tunlink "$INTERFACE"
+ [ -n "$ZONE_MAP" ] || ZONE_MAP=$ZONE
[ -n "$ZONE_MAP" ] && json_add_string zone "$ZONE_MAP"
[ -n "$IFACE_MAP_DELEGATE" ] && json_add_boolean delegate "$IFACE_MAP_DELEGATE"
json_close_object
ubus call network add_dynamic "$(json_dump)"
+ elif [ -n "$AFTR_IP " -a "$IFACE_DSLITE" != 0 -a -f /lib/netifd/proto/dslite.sh ]; then
+ [ -z "$IFACE_DSLITE" -o "$IFACE_DSLITE" = 1 ] && IFACE_DSLITE=${INTERFACE}_dslite
+ json_init
+ json_add_string name "$IFACE_DSLITE"
+ json_add_string ifname "@$INTERFACE"
+ json_add_string proto "dslite"
+ json_add_string peeraddr "$AFTR_IP"
+ json_add_string tunlink "$INTERFACE"
+ [ -n "$ZONE_DSLITE" ] || ZONE_DSLITE=$ZONE
+ [ -n "$ZONE_DSLITE" ] && json_add_string zone "$ZONE_DSLITE"
+ [ -n "$IFACE_DSLITE_DELEGATE" ] && json_add_boolean delegate "$IFACE_DSLITE_DELEGATE"
+ json_close_object
+ ubus call network add_dynamic "$(json_dump)"
fi
# TODO: $SNTP_IP $SIP_IP $SNTP_FQDN $SIP_DOMAIN
diff --git a/package/network/ipv6/odhcp6c/files/dhcpv6.sh b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
index 1c6d609d43..0690bd15e5 100755
--- a/package/network/ipv6/odhcp6c/files/dhcpv6.sh
+++ b/package/network/ipv6/odhcp6c/files/dhcpv6.sh
@@ -19,6 +19,7 @@ proto_dhcpv6_init_config() {
proto_config_add_string zone_dslite
proto_config_add_string iface_map
proto_config_add_string zone_map
+ proto_config_add_string zone
proto_config_add_string 'ifaceid:ip6addr'
proto_config_add_string 'sourcerouting:bool'
proto_config_add_string "userclass"
@@ -31,8 +32,8 @@ proto_dhcpv6_setup() {
local config="$1"
local iface="$2"
- local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map soltimeout
- json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map soltimeout
+ local reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map zone soltimeout
+ json_get_vars reqaddress reqprefix clientid reqopts noslaaconly forceprefix norelease ip6prefix iface_dslite iface_map ifaceid sourcerouting userclass vendorclass delegate zone_dslite zone_map zone soltimeout
# Configure
@@ -70,6 +71,7 @@ proto_dhcpv6_setup() {
[ "$delegate" = "0" ] && proto_export "IFACE_MAP_DELEGATE=0"
[ -n "$zone_dslite" ] && proto_export "ZONE_DSLITE=$zone_dslite"
[ -n "$zone_map" ] && proto_export "ZONE_MAP=$zone_map"
+ [ -n "$zone" ] && proto_export "ZONE=$zone"
proto_export "INTERFACE=$config"
proto_run_command "$config" odhcp6c \