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_boolean
'release:bool'
16 proto_config_add_string
'reqopts:list(string)'
17 proto_config_add_string iface6rd
18 proto_config_add_string sendopts
19 proto_config_add_boolean delegate
20 proto_config_add_string zone6rd
21 proto_config_add_string zone
22 proto_config_add_string mtu6rd
23 proto_config_add_string customroutes
30 local ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
31 json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes
34 for opt
in $reqopts; do
35 append dhcpopts
"-O $opt"
38 for opt
in $sendopts; do
39 append dhcpopts
"-x $opt"
42 [ "$broadcast" = 1 ] && broadcast
="-B" || broadcast
=
43 [ "$release" = 1 ] && release
="-R" || release
=
44 [ -n "$clientid" ] && clientid
="-x 0x3d:${clientid//:/}" || clientid
="-C"
45 [ -n "$iface6rd" ] && proto_export
"IFACE6RD=$iface6rd"
46 [ "$iface6rd" != 0 -a -f /lib
/netifd
/proto
/6rd.sh
] && append dhcpopts
"-O 212"
47 [ -n "$zone6rd" ] && proto_export
"ZONE6RD=$zone6rd"
48 [ -n "$zone" ] && proto_export
"ZONE=$zone"
49 [ -n "$mtu6rd" ] && proto_export
"MTU6RD=$mtu6rd"
50 [ -n "$customroutes" ] && proto_export
"CUSTOMROUTES=$customroutes"
51 [ "$delegate" = "0" ] && proto_export
"IFACE6RD_DELEGATE=0"
53 proto_export
"INTERFACE=$config"
54 proto_run_command
"$config" udhcpc \
55 -p /var
/run
/udhcpc-
$iface.pid \
56 -s /lib
/netifd
/dhcp.
script \
58 ${ipaddr:+-r $ipaddr} \
59 ${hostname:+-H $hostname} \
60 ${vendorid:+-V $vendorid} \
61 $clientid $broadcast $release $dhcpopts
66 # SIGUSR1 forces udhcpc to renew its lease
67 local sigusr1
="$(kill -l SIGUSR1)"
68 [ -n "$sigusr1" ] && proto_kill_command
"$interface" $sigusr1
71 proto_dhcp_teardown
() {
73 proto_kill_command
"$interface"