@ -16,7 +16,7 @@ proto_dhcp_init_config() {
proto_config_add_string 'reqopts:list(string)'
proto_config_add_boolean 'defaultreqopts:bool'
proto_config_add_string iface6rd
proto_config_add_string sendopts
proto_config_add_array 'sendopts:list(string)'
proto_config_add_boolean delegate
proto_config_add_string zone6rd
proto_config_add_string zone
@ -25,21 +25,23 @@ proto_dhcp_init_config() {
proto_config_add_boolean classlessroute
}
proto_dhcp_add_sendopts( ) {
[ -n " $1 " ] && append " $3 " " -x $1 "
}
proto_dhcp_setup( ) {
local config = " $1 "
local iface = " $2 "
local ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd sendopts delegate zone6rd zone mtu6rd customroutes classlessroute
json_get_vars ipaddr hostname clientid vendorid broadcast release reqopts defaultreqopts iface6rd delegate zone6rd zone mtu6rd customroutes classlessroute
local opt dhcpopts
for opt in $reqopts ; do
append dhcpopts " -O $opt "
done
for opt in $sendopts ; do
append dhcpopts " -x $opt "
done
json_for_each_item proto_dhcp_add_sendopts sendopts dhcpopts
[ -z " $hostname " ] && hostname = " $( cat /proc/sys/kernel/hostname) "
[ " $defaultreqopts " = 0 ] && defaultreqopts = "-o" || defaultreqopts =