2 [ -z "$1" ] && echo "Error: should be run by udhcpc" && exit 1
5 . /lib/netifd/netifd-proto.sh
7 set_classless_routes() {
10 while [ -n "$1" -a -n "$2" -a $max -gt 0 ]; do
11 proto_add_ipv4_route "${1%%/*}" "${1##*/}" "$2"
18 proto_init_update "*" 1
19 proto_add_ipv4_address "$ip" "${subnet:-255.255.255.0}"
20 # TODO: apply $broadcast
23 proto_add_ipv4_route 0.0.0.0 0 "$i"
26 # CIDR STATIC ROUTES (rfc3442)
27 [ -n "$staticroutes" ] && set_classless_routes $staticroutes
28 [ -n "$msstaticroutes" ] && set_classless_routes $msstaticroutes
31 proto_add_dns_server "$dns"
33 for domain in $domain; do
34 proto_add_dns_search "$domain"
38 [ -n "$ZONE" ] && json_add_string zone "$ZONE"
41 proto_send_update "$INTERFACE"
44 if [ "$IFACE6RD" != 0 -a -n "$ip6rd" ]; then
45 local v4mask="${ip6rd%% *}"
47 local ip6rdprefixlen="${ip6rd%% *}"
49 local ip6rdprefix="${ip6rd%% *}"
51 local ip6rdbr="${ip6rd%% *}"
53 [ -n "$ZONE" ] || ZONE=$(fw3 -q network $INTERFACE)
54 [ -z "$IFACE6RD" -o "$IFACE6RD" = 1 ] && IFACE6RD=${INTERFACE}_6rd
57 json_add_string name "$IFACE6RD"
58 json_add_string ifname "@$INTERFACE"
59 json_add_string proto "6rd"
60 json_add_string peeraddr "$ip6rdbr"
61 json_add_int ip4prefixlen "$v4mask"
62 json_add_string ip6prefix "$ip6rdprefix"
63 json_add_int ip6prefixlen "$ip6rdprefixlen"
64 json_add_string tunlink "$INTERFACE"
65 [ -n "$IFACE6RD_DELEGATE" ] && json_add_boolean delegate "$IFACE6RD_DELEGATE"
66 [ -n "$ZONE6RD" ] || ZONE6RD=$ZONE
67 [ -n "$ZONE6RD" ] && json_add_string zone "$ZONE6RD"
70 ubus call network add_dynamic "$(json_dump)"
74 # [ -n "$ntpsrv" ] && change_state network "$ifc" lease_ntpsrv "$ntpsrv"
75 # [ -n "$timesvr" ] && change_state network "$ifc" lease_timesrv "$timesvr"
76 # [ -n "$hostname" ] && change_state network "$ifc" lease_hostname "$hostname"
77 # [ -n "$timezone" ] && change_state network "$ifc" lease_timezone "$timezone"
80 deconfig_interface() {
81 proto_init_update "*" 0
82 proto_send_update "$INTERFACE"
95 [ -f /etc/udhcpc.user ] && . /etc/udhcpc.user