aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHans Dedecker <dedeckeh@gmail.com>2017-04-26 22:37:27 +0200
committerHans Dedecker <dedeckeh@gmail.com>2017-04-27 22:04:29 +0200
commit9412fc294995ae2543fabf84d2ce39a80bfb3bd6 (patch)
tree48cadb59df2dd534c75480d306cf6cb2b229d8fa
parent4b4f73937371cc628692c812fdb12eca8a635e5c (diff)
downloadupstream-9412fc294995ae2543fabf84d2ce39a80bfb3bd6.tar.gz
upstream-9412fc294995ae2543fabf84d2ce39a80bfb3bd6.tar.bz2
upstream-9412fc294995ae2543fabf84d2ce39a80bfb3bd6.zip
dnsmasq: support dhcp_option config as a list
Configuring dhcp_option as an option does not allow the usage of white spaces in the option value; fix this by supporting dhcp_option as a list config while still supporting the option config to maintain backwards compatibility Signed-off-by: Jo-Philipp Wich <jo@mein.io> Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
-rw-r--r--package/network/services/dnsmasq/files/dnsmasq.init25
1 files changed, 21 insertions, 4 deletions
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 448d3ee9b0..4291df2544 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -538,6 +538,14 @@ dhcp_add() {
dhcp_option_add "$cfg" "$networkid"
}
+dhcp_option_append() {
+ local option="$1"
+ local networkid="$2"
+ local force="$3"
+
+ xappend "--dhcp-option${force:+-force}=${networkid:+$networkid,}$option"
+}
+
dhcp_option_add() {
# NOTE: dnsmasq has explicit "option6:" prefix for DHCPv6 so no collisions
local cfg="$1"
@@ -546,11 +554,20 @@ dhcp_option_add() {
[ "$force" = "0" ] && force=
- config_get dhcp_option "$cfg" dhcp_option
- for o in $dhcp_option; do
- xappend "--dhcp-option${force:+-force}=${networkid:+$networkid,}$o"
- done
+ local list_len
+ config_get list_len "$cfg" dhcp_option_LENGTH
+
+ if [ -n "$list_len" ]; then
+ config_list_foreach "$cfg" dhcp_option dhcp_option_append "$networkid" "$force"
+ else
+ echo "Warning: the 'option dhcp_option' syntax is deprecated, use 'list dhcp_option'" >&2
+ config_get dhcp_option "$cfg" dhcp_option
+ local option
+ for option in $dhcp_option; do
+ dhcp_option_append "$option" "$networkid" "$force"
+ done
+ fi
}
dhcp_domain_add() {