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
18 proto_config_add_string zone6rd
25 local ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd
26 json_get_vars ipaddr hostname clientid vendorid broadcast reqopts iface6rd sendopts delegate zone6rd
29 for opt
in $reqopts; do
30 append dhcpopts
"-O $opt"
33 for opt
in $sendopts; do
34 append dhcpopts
"-x $opt"
37 [ "$broadcast" = 1 ] && broadcast
="-B" || broadcast
=
38 [ -n "$clientid" ] && clientid
="-x 0x3d:${clientid//:/}" || clientid
="-C"
39 [ -n "$iface6rd" ] && proto_export
"IFACE6RD=$iface6rd"
40 [ -n "$iface6rd" ] && append dhcpopts
"-O 212"
41 [ -n "$zone6rd" ] && proto_export
"ZONE6RD=$zone6rd"
42 [ "$delegate" = "0" ] && proto_export
"IFACE6RD_DELEGATE=0"
44 proto_export
"INTERFACE=$config"
45 proto_run_command
"$config" udhcpc \
46 -p /var
/run
/udhcpc-
$iface.pid \
47 -s /lib
/netifd
/dhcp.
script \
49 ${ipaddr:+-r $ipaddr} \
50 ${hostname:+-H $hostname} \
51 ${vendorid:+-V $vendorid} \
52 $clientid $broadcast $dhcpopts
55 proto_dhcp_teardown
() {
57 proto_kill_command
"$interface"