7 proto_dhcp_init_config
() {
8 proto_config_add_string
"ipaddr"
9 proto_config_add_string
"netmask"
10 proto_config_add_string
"hostname"
11 proto_config_add_string
"clientid"
12 proto_config_add_string
"vendorid"
13 proto_config_add_boolean
"broadcast"
14 proto_config_add_string
"reqopts"
21 local ipaddr hostname clientid vendorid broadcast reqopts
22 json_get_vars ipaddr hostname clientid vendorid broadcast reqopts
25 for opt
in $reqopts; do
26 append dhcpopts
"-O $opt"
29 [ "$broadcast" = 1 ] && broadcast
="-B" || broadcast
=
30 [ -n "$clientid" ] && clientid
="-x 0x3d:${clientid//:/}" || clientid
="-C"
32 proto_export
"INTERFACE=$config"
33 proto_run_command
"$config" udhcpc \
34 -p /var
/run
/udhcpc-
$iface.pid \
35 -s /lib
/netifd
/dhcp.
script \
37 ${ipaddr:+-r $ipaddr} \
38 ${hostname:+-H $hostname} \
39 ${vendorid:+-V $vendorid} \
40 $clientid $broadcast $dhcpopts
43 proto_dhcp_teardown
() {
45 proto_kill_command
"$interface"