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
28 local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd
29 json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd zone mtu6rd
32 for opt
in $reqopts; do
33 append dhcpopts
"-O $opt"
36 for opt
in $sendopts; do
37 append dhcpopts
"-x $opt"
40 [ "$broadcast" = 1 ] && broadcast
="-B" || broadcast
=
41 [ -n "$clientid" ] && clientid
="-x 0x3d:${clientid//:/}" || clientid
="-C"
42 [ -n "$iface6rd" ] && proto_export
"IFACE6RD=$iface6rd"
43 [ -n "$iface6rd" ] && append dhcpopts
"-O 212"
44 [ -n "$zone6rd" ] && proto_export
"ZONE6RD=$zone6rd"
45 [ -n "$zone" ] && proto_export
"ZONE=$zone"
46 [ -n "$mtu6rd" ] && proto_export
"MTU6RD=$mtu6rd"
47 [ "$delegate" = "0" ] && proto_export
"IFACE6RD_DELEGATE=0"
49 proto_export
"INTERFACE=$config"
50 proto_run_command
"$config" udhcpc \
51 -p /var
/run
/udhcpc-
$iface.pid \
52 -s /lib
/netifd
/dhcp.
script \
54 ${ipaddr:+-r $ipaddr} \
55 ${hostname:+-H $hostname} \
56 ${vendorid:+-V $vendorid} \
57 $clientid $broadcast $dhcpopts
62 # SIGUSR1 forces udhcpc to renew its lease
63 local sigusr1
="$(kill -l SIGUSR1)"
64 [ -n "$sigusr1" ] && proto_kill_command
"$interface" $sigusr1
67 proto_dhcp_teardown
() {
69 proto_kill_command
"$interface"