From 7f573ef7e3738a4eb509deead4f38f338a913f55 Mon Sep 17 00:00:00 2001
From: Jo-Philipp Wich <jow@openwrt.org>
Date: Sun, 1 Jul 2012 11:32:29 +0000
Subject: [PATCH] package/dnsmasq: permit dhcp_option in global dnsmasq config
 section

dnsmasq currently permits dhcp_options to be specified only in "config dhcp"
sections of /etc/config/dhcp. When dnsmasq is providing DHCP service for
multiple subnets and there are multiple "config dhcp" sections without "option
ignore", it makes sense to allow dhcp_options that should apply globally in
the "config dnsmasq" section of /etc/config/dhcp. dhcp_option is a list option.

[jow: rework patch to apply after dhcp-option-force handling got introduced]

Signed-off-by: Mark Mentovai <mark@moxienet.com>

SVN-Revision: 32568
---
 package/dnsmasq/files/dnsmasq.init | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/dnsmasq/files/dnsmasq.init b/package/dnsmasq/files/dnsmasq.init
index 92e10ee49406..a1334d05fcf1 100644
--- a/package/dnsmasq/files/dnsmasq.init
+++ b/package/dnsmasq/files/dnsmasq.init
@@ -143,6 +143,8 @@ dnsmasq() {
 		config_list_foreach "$cfg" rebind_domain append_rebind_domain
 	}
 
+	dhcp_option_add "$cfg" "" 0
+
 	echo >> $CONFIGFILE
 }
 
@@ -362,7 +364,7 @@ dhcp_option_add() {
 
 	config_get dhcp_option "$cfg" dhcp_option
 	for o in $dhcp_option; do
-		xappend "--dhcp-option${force:+-force}=$networkid","$o"
+		xappend "--dhcp-option${force:+-force}=${networkid:+$networkid,}$o"
 	done
 
 }
-- 
2.30.2