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
="-O broadcast" || broadcast
=
31 proto_export
"INTERFACE=$config"
32 proto_run_command
"$config" udhcpc \
33 -p /var
/run
/udhcpc-
$iface.pid \
34 -s /lib
/netifd
/dhcp.
script \
36 ${ipaddr:+-r $ipaddr} \
37 ${hostname:+-H $hostname} \
38 ${clientid:+-x 0x3d:${clientid//:/}} \
39 ${vendorid:+-V $vendorid} \
43 proto_dhcp_teardown
() {
45 proto_kill_command
"$interface"