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%% *}"
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"
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
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
[ -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"
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"
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
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"
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
[ "$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 \