6rd / ds-lite: make the firewall-zones of nested-protocols configurable
[openwrt.git] / package / network / config / netifd / files / lib / netifd / dhcp.script
index d26db0f..948c3cd 100755 (executable)
@@ -35,6 +35,31 @@ 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%% *}"
+
+               json_init
+               json_add_string name "$IFACE6RD"
+               json_add_string ifname "@$INTERFACE"
+               json_add_string proto "6rd"
+               json_add_string peeraddr "$ip6rdbr"
+               json_add_int ip4prefixlen "$v4mask"
+               json_add_string ip6prefix "$ip6rdprefix"
+               json_add_int ip6prefixlen "$ip6rdprefixlen"
+               json_add_string tunlink "$INTERFACE"
+               [ -n "$IFACE6RD_DELEGATE" ] && json_add_boolean delegate "$IFACE6RD_DELEGATE"
+               [ -n "$ZONE6RD" ] && json_add_string zone "$ZONE6RD"
+               json_close_object
+
+               ubus call network add_dynamic "$(json_dump)"
+       fi
+
        # TODO
        # [ -n "$ntpsrv" ] &&   change_state network "$ifc" lease_ntpsrv "$ntpsrv"
        # [ -n "$timesvr" ] &&  change_state network "$ifc" lease_timesrv "$timesvr"