7 proto_dhcp_init_config
() {
10 proto_config_add_string
'ipaddr:ipaddr'
11 proto_config_add_string
'hostname:hostname'
12 proto_config_add_string clientid
13 proto_config_add_string vendorid
14 proto_config_add_boolean
'broadcast:bool'
15 proto_config_add_string
'reqopts:list(string)'
16 proto_config_add_string iface6rd
17 proto_config_add_string sendopts
18 proto_config_add_boolean delegate
19 proto_config_add_string zone6rd
20 proto_config_add_string zone
21 proto_config_add_string mtu6rd
22 proto_config_add_string customroutes
29 local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
30 json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
33 for opt
in $reqopts; do
34 append dhcpopts
"-O $opt"
37 for opt
in $sendopts; do
38 append dhcpopts
"-x $opt"
41 [ "$broadcast" = 1 ] && broadcast
="-B" || broadcast
=
42 [ -n "$clientid" ] && clientid
="-x 0x3d:${clientid//:/}" || clientid
="-C"
43 [ -n "$iface6rd" ] && proto_export
"IFACE6RD=$iface6rd"
44 [ "$iface6rd" != 0 -a -f /lib
/netifd
/proto
/6rd.sh
] && append dhcpopts
"-O 212"
45 [ -n "$zone6rd" ] && proto_export
"ZONE6RD=$zone6rd"
46 [ -n "$zone" ] && proto_export
"ZONE=$zone"
47 [ -n "$mtu6rd" ] && proto_export
"MTU6RD=$mtu6rd"
48 [ -n "$customroutes" ] && proto_export
"CUSTOMROUTES=$customroutes"
49 [ "$delegate" = "0" ] && proto_export
"IFACE6RD_DELEGATE=0"
51 proto_export
"INTERFACE=$config"
52 proto_run_command
"$config" udhcpc \
53 -p /var
/run
/udhcpc-
$iface.pid \
54 -s /lib
/netifd
/dhcp.
script \
56 ${ipaddr:+-r $ipaddr} \
57 ${hostname:+-H $hostname} \
58 ${vendorid:+-V $vendorid} \
59 $clientid $broadcast $dhcpopts
64 # SIGUSR1 forces udhcpc to renew its lease
65 local sigusr1
="$(kill -l SIGUSR1)"
66 [ -n "$sigusr1" ] && proto_kill_command
"$interface" $sigusr1
69 proto_dhcp_teardown
() {
71 proto_kill_command
"$interface"