7 proto_dhcp_init_config
() {
8 proto_config_add_string
'ipaddr:ipaddr'
9 proto_config_add_string
'netmask:ipaddr'
10 proto_config_add_string
'hostname:hostname'
11 proto_config_add_string clientid
12 proto_config_add_string vendorid
13 proto_config_add_boolean
'broadcast:ipaddr'
14 proto_config_add_string
'reqopts:list(string)'
15 proto_config_add_string iface6rd
16 proto_config_add_string sendopts
17 proto_config_add_boolean delegate
24 local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate
25 json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate
28 for opt
in $reqopts; do
29 append dhcpopts
"-O $opt"
32 for opt
in $sendopts; do
33 append dhcpopts
"-x $opt"
36 [ "$broadcast" = 1 ] && broadcast
="-B" || broadcast
=
37 [ -n "$clientid" ] && clientid
="-x 0x3d:${clientid//:/}" || clientid
="-C"
38 [ -n "$iface6rd" ] && proto_export
"IFACE6RD=$iface6rd"
39 [ -n "$iface6rd" ] && append dhcpopts
"-O 212"
40 [ "$delegate" = "0" ] && proto_export
"IFACE6RD_DELEGATE=0"
42 proto_export
"INTERFACE=$config"
43 proto_run_command
"$config" udhcpc \
44 -p /var
/run
/udhcpc-
$iface.pid \
45 -s /lib
/netifd
/dhcp.
script \
47 ${ipaddr:+-r $ipaddr} \
48 ${hostname:+-H $hostname} \
49 ${vendorid:+-V $vendorid} \
50 $clientid $broadcast $dhcpopts
53 proto_dhcp_teardown
() {
55 proto_kill_command
"$interface"