forked from Ivasoft/openwrt
softwires: redesign dhcp(v6) provisioning
Signed-off-by: Steven Barth <steven@midlink.org> SVN-Revision: 41823
This commit is contained in:
@@ -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
|
||||
|
||||
|
||||
@@ -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"
|
||||
|
||||
Reference in New Issue
Block a user