aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
Diffstat (limited to 'package')
-rwxr-xr-xpackage/network/config/netifd/files/lib/netifd/dhcp.script12
-rwxr-xr-xpackage/network/config/netifd/files/lib/netifd/proto/dhcp.sh6
-rwxr-xr-xpackage/network/ipv6/odhcp6c/files/dhcpv6.script39
-rwxr-xr-xpackage/network/ipv6/odhcp6c/files/dhcpv6.sh6
4 files changed, 41 insertions, 22 deletions
diff --git a/package/network/config/netifd/files/lib/netifd/dhcp.script b/package/network/config/netifd/files/lib/netifd/dhcp.script
index 948c3cd665..db3fc011a1 100755
--- a/package/network/config/netifd/files/lib/netifd/dhcp.script
+++ b/package/network/config/netifd/files/lib/netifd/dhcp.script
@@ -33,9 +33,15 @@ setup_interface () {
for domain in $domain; do
proto_add_dns_search "$domain"
done
+
+ proto_add_data
+ [ -n "$ZONE" ] && json_add_string zone "$ZONE"
+ proto_close_data
+
proto_send_update "$INTERFACE"
- if [ -n "$IFACE6RD" -a -n "$ip6rd" ]; then
+
+ if [ "$IFACE6RD" != 0 -a -n "$ip6rd" ]; then
local v4mask="${ip6rd%% *}"
ip6rd="${ip6rd#* }"
local ip6rdprefixlen="${ip6rd%% *}"
@@ -44,6 +50,9 @@ setup_interface () {
ip6rd="${ip6rd#* }"
local ip6rdbr="${ip6rd%% *}"
+ [ -n "$ZONE" ] || ZONE=$(fw3 network $INTERFACE)
+ [ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6rd
+
json_init
json_add_string name "$IFACE6RD"
json_add_string ifname "@$INTERFACE"
@@ -54,6 +63,7 @@ setup_interface () {
json_add_int ip6prefixlen "$ip6rdprefixlen"
json_add_string tunlink "$INTERFACE"
[ -n "$IFACE6RD_DELEGATE" ] && json_add_boolean delegate "$IFACE6RD_DELEGATE"
+ [ -n "$ZONE6RD" ] || ZONE6RD=$ZONE
[ -n "$ZONE6RD" ] && json_add_string zone "$ZONE6RD"
json_close_object
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 178ff551b5..b14f7be92d 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -17,14 +17,15 @@ proto_dhcp_init_config() {
proto_config_add_string sendopts
proto_config_add_boolean delegate
proto_config_add_string zone6rd
+ proto_config_add_string zone
}
proto_dhcp_setup() {
local config="$1"
local iface="$2"
- local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd
- json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd
+ local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
+ json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone
local opt dhcpopts
for opt in $reqopts; do
@@ -40,6 +41,7 @@ proto_dhcp_setup() {
[ -n "$iface6rd" ] && proto_export "IFACE6RD=$iface6rd"
[ -n "$iface6rd" ] && append dhcpopts "-O 212"
[ -n "$zone6rd" ] && proto_export "ZONE6RD=$zone6rd"
+ [ -n "$zone" ] && proto_export "ZONE=$zone"
[ "$delegate" = "0" ] && proto_export "IFACE6RD_DELEGATE=0"
proto_export "INTERFACE=$config"
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 \