aboutsummaryrefslogtreecommitdiffstats
path: root/package/network/config/netifd
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2018-02-24 16:52:38 +0100
committerHans Dedecker <dedeckeh@gmail.com>2018-02-27 13:36:46 +0100
commit3bd2e195ecdcf77482a983451067ad725771de4b (patch)
tree323822e7500fd89581a5d2a6fb285bde8e7eb004 /package/network/config/netifd
parente9b58b22c100b29c8643e73127f580d24f4ed482 (diff)
downloadupstream-3bd2e195ecdcf77482a983451067ad725771de4b.tar.gz
upstream-3bd2e195ecdcf77482a983451067ad725771de4b.tar.bz2
upstream-3bd2e195ecdcf77482a983451067ad725771de4b.zip
netifd: support DHCP sendopts as list options
Support config in the form of .... add_list sendopts=router:10.10.10.2 add_list sendopts=nissrv:20.20.20.2 add_list sendopts=0x7D:abba This allows to configure sendopts having white spaces as option value Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
Diffstat (limited to 'package/network/config/netifd')
-rw-r--r--package/network/config/netifd/Makefile2
-rwxr-xr-xpackage/network/config/netifd/files/lib/netifd/proto/dhcp.sh12
2 files changed, 8 insertions, 6 deletions
diff --git a/package/network/config/netifd/Makefile b/package/network/config/netifd/Makefile
index d2210e7c2e..d62b60ad98 100644
--- a/package/network/config/netifd/Makefile
+++ b/package/network/config/netifd/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=netifd
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL=$(PROJECT_GIT)/project/netifd.git
diff --git a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
index 385cfc3974..afcfba9f49 100755
--- a/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
+++ b/package/network/config/netifd/files/lib/netifd/proto/dhcp.sh
@@ -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=