[OpenWrt-Devel] [PATCH 1/2] dnsmasq: Fix dhcp option parsing

Hans Dedecker dedeckeh at gmail.com
Thu Mar 31 06:18:28 EDT 2016


Parse dhcp options as a config list; this fixes dhcp options which contain
a white space as it resulted into an invalid config

Signed-off-by: Hans Dedecker <dedeckeh at gmail.com>
---
 package/network/services/dnsmasq/files/dnsmasq.init | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index 61ded6a..2d36fc6 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -446,6 +446,10 @@ dhcp_add() {
 	dhcp_option_add "$cfg" "$networkid"
 }
 
+dhcp_handle_option_add() {
+	xappend "--dhcp-option${force:+-force}=${networkid:+$networkid,}$1"
+}
+
 dhcp_option_add() {
 	local cfg="$1"
 	local networkid="$2"
@@ -453,11 +457,7 @@ 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
-
+	config_list_foreach "$cfg" dhcp_option dhcp_handle_option_add
 }
 
 dhcp_domain_add() {
-- 
1.9.1
_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel


More information about the openwrt-devel mailing list