diff mbox

[OpenWrt-Devel,v2,2/2] dnsmasq: fix dependency problems of the dnsmasq-full variant.

Message ID 1419941919-30009-2-git-send-email-yszhou4tech@gmail.com
State Accepted
Headers show

Commit Message

Yousong Zhou Dec. 30, 2014, 12:18 p.m. UTC
This patch tries to

 - Let the DHCPv6 feature depend on CONFIG_IPV6.
 - Conditionally select libnettle, kmod-ipv6, kmod-ipt-ipset only if the
   corresponding features are enabled.
 - Install `trust-anchors.conf` only if DNSSEC is selected.
 - Add PKG_CONFIG_DEPENDS for the configurable options.
 - Add a patch to let the Makefile of dnsmasq be aware of changes in
   COPTS variable.

Big thanks goes to Frank Schäfer <fschaefer.oss@googlemail.com> for
providing necessary information on connections and dependency relations
between these CONFIGs and packages.

Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
---
v2 <- v1

	- Add PKG_CONFIG_DEPENDS variable for better cooperation with OpenWrt build system.
	- Patch Makefile of dnsmasq to let it rebuild with changed COPTS variable.
	- Rename ipset, IPSET to IPset.
	- Break long lines into shorter ones.
	- Description text changes with the "configurable" feature in mind.

 package/network/services/dnsmasq/Makefile          |   49 +++++++++++---------
 ...0-let-makefile-be-aware-of-config-changes.patch |   42 +++++++++++++++++
 2 files changed, 70 insertions(+), 21 deletions(-)
 create mode 100644 package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch

Comments

Frank Schäfer Dec. 31, 2014, 10:33 a.m. UTC | #1
Am 30.12.2014 um 13:18 schrieb Yousong Zhou:
> This patch tries to
>
>  - Let the DHCPv6 feature depend on CONFIG_IPV6.
>  - Conditionally select libnettle, kmod-ipv6, kmod-ipt-ipset only if the
>    corresponding features are enabled.
>  - Install `trust-anchors.conf` only if DNSSEC is selected.
>  - Add PKG_CONFIG_DEPENDS for the configurable options.
>  - Add a patch to let the Makefile of dnsmasq be aware of changes in
>    COPTS variable.
>
> Big thanks goes to Frank Schäfer <fschaefer.oss@googlemail.com> for
> providing necessary information on connections and dependency relations
> between these CONFIGs and packages.
>
> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
> ---
> v2 <- v1
>
> 	- Add PKG_CONFIG_DEPENDS variable for better cooperation with OpenWrt build system.
> 	- Patch Makefile of dnsmasq to let it rebuild with changed COPTS variable.
> 	- Rename ipset, IPSET to IPset.
> 	- Break long lines into shorter ones.
> 	- Description text changes with the "configurable" feature in mind.
>
>  package/network/services/dnsmasq/Makefile          |   49 +++++++++++---------
>  ...0-let-makefile-be-aware-of-config-changes.patch |   42 +++++++++++++++++
>  2 files changed, 70 insertions(+), 21 deletions(-)
>  create mode 100644 package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>
> diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
> index 1153428..766aaf0 100644
> --- a/package/network/services/dnsmasq/Makefile
> +++ b/package/network/services/dnsmasq/Makefile
> @@ -22,6 +22,10 @@ PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSI
>  
>  PKG_INSTALL:=1
>  PKG_BUILD_PARALLEL:=1
> +PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6 \
> +	CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec \
> +	CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth \
> +	CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset
>  
>  include $(INCLUDE_DIR)/package.mk
>  
> @@ -46,8 +50,10 @@ endef
>  
>  define Package/dnsmasq-full
>  $(call Package/dnsmasq/Default)
> -  TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPSET)
> -  DEPENDS:=@IPV6 +kmod-ipv6 +libnettle
> +  TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset enabled by default)
> +  DEPENDS:=+PACKAGE_dnsmasq_full_dnssec:libnettle \
> +	+PACKAGE_dnsmasq_full_dhcpv6:kmod-ipv6 \
> +	+PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset
>    VARIANT:=full
>  endef
>  
> @@ -64,7 +70,8 @@ endef
>  define Package/dnsmasq-full/description
>  $(call Package/dnsmasq/description)
>  
> -This is a variant with DHCPv6, DNSSEC, Authroitative DNS and IPSET support
> +This is a fully configurable variant with DHCPv6, DNSSEC, Authroitative DNS and
> +IPset support enabled by default.
>  endef
>  
>  define Package/dnsmasq/conffiles
> @@ -72,26 +79,24 @@ define Package/dnsmasq/conffiles
>  /etc/dnsmasq.conf
>  endef
>  
> -define Package/dnsmasq/config/Default
> -  if PACKAGE_$(1)-$(2)
> -  config PACKAGE_dnsmasq_$(2)_dhcpv6
> -    bool "Build with DHCPv6 support."
> -    default y
> -  config PACKAGE_dnsmasq_$(2)_dnssec
> -    bool "Build with DNSSEC support."
> -    default y
> -  config PACKAGE_dnsmasq_$(2)_auth
> -    bool "Build with the facility to act as an authoritative DNS server."
> -    default y
> -  config PACKAGE_dnsmasq_$(2)_ipset
> -    bool "Build with ipset support."
> -    select PACKAGE_kmod-ipt-ipset
> -    default y
> -  endif
> +define Package/dnsmasq-full/config
> +	if PACKAGE_dnsmasq-full
> +	config PACKAGE_dnsmasq_full_dhcpv6
> +		bool "Build with DHCPv6 support."
> +		depends on IPV6
> +		default y
> +	config PACKAGE_dnsmasq_full_dnssec
> +		bool "Build with DNSSEC support."
> +		default y
> +	config PACKAGE_dnsmasq_full_auth
> +		bool "Build with the facility to act as an authoritative DNS server."
> +		default y
> +	config PACKAGE_dnsmasq_full_ipset
> +		bool "Build with IPset support."
> +		default y
> +	endif
>  endef

tmp/.config-package.in:93:error: recursive dependency detected!
tmp/.config-package.in:93:      symbol PACKAGE_dnsmasq-full depends on
PACKAGE_dnsmasq_full_ipset
tmp/.config-package.in:124:     symbol PACKAGE_dnsmasq_full_ipset
depends on PACKAGE_dnsmasq-full

If you make a menuconfig, the IPSET build option also doesn't show up
unless you have selected DNSSEC...

Can you please test your patches before sending them to the list ?


> -Package/dnsmasq-full/config=$(call Package/dnsmasq/config/Default,dnsmasq,full)
> -
>  Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles)
>  Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles)
>  
> @@ -137,8 +142,10 @@ Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
>  
>  define Package/dnsmasq-full/install
>  $(call Package/dnsmasq/install,$(1))
> +ifneq ($(CONFIG_PACKAGE_dnsmasq_full_dnssec),)
>  	$(INSTALL_DIR) $(1)/usr/share/dnsmasq
>  	$(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq
> +endif
>  endef
>  
>  $(eval $(call BuildPackage,dnsmasq))
> diff --git a/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
> new file mode 100644
> index 0000000..663f0e9
> --- /dev/null
> +++ b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
> @@ -0,0 +1,42 @@
> +Index: dnsmasq-2.72/Makefile
> +===================================================================
> +--- dnsmasq-2.72.orig/Makefile	2014-12-30 19:46:10.484921940 +0800
> ++++ dnsmasq-2.72/Makefile	2014-12-30 19:56:39.712926794 +0800
> +@@ -74,6 +74,10 @@
> + hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
> +        dns-protocol.h radv-protocol.h ip6addr.h
> + 
> ++COPT_CONF = $(top)/.copt_$(shell $(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/config.h | \
> ++			( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ')
> ++COPT_CONF_WILD = $(top)/.copt_*
> ++
> + all : $(BUILDDIR)
> + 	@cd $(BUILDDIR) && $(MAKE) \
> +  top="$(top)" \
> +@@ -83,7 +87,7 @@
> + 
> + mostly_clean :
> + 	rm -f $(BUILDDIR)/*.mo $(BUILDDIR)/*.pot 
> +-	rm -f $(BUILDDIR)/.configured $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq 
> ++	rm -f $(BUILDDIR)/$(COPT_CONF_WILD) $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq
> + 
> + clean : mostly_clean
> + 	rm -f $(BUILDDIR)/dnsmasq_baseline
> +@@ -139,7 +143,7 @@
> + 
> + # rules below are targets in recusive makes with cwd=$(BUILDDIR)
> + 
> +-.configured: $(hdrs)
> ++$(COPT_CONF): $(hdrs)
> + 	@rm -f *.o
> + 	@touch $@
> + 
> +@@ -149,7 +153,7 @@
> + .c.o:
> + 	$(CC) $(CFLAGS) $(COPTS) $(i18n) $(build_cflags) $(RPM_OPT_FLAGS) -c $<	
> + 
> +-dnsmasq : .configured $(hdrs) $(objs)
> ++dnsmasq : $(COPT_CONF) $(hdrs) $(objs)
> + 	$(CC) $(LDFLAGS) -o $@ $(objs) $(build_libs) $(LIBS) 
> + 
> + dnsmasq.pot : $(objs:.o=.c) $(hdrs)
Urgh... is it really necessary to patch dnsmasqs native Makefile ?
Can you give us a practical and reproducable example that shows the
problem you are trying to solve here ?

Regards,
Frank
Yousong Zhou Dec. 31, 2014, 10:48 a.m. UTC | #2
Hi, Frank

On 31 December 2014 at 18:33, Frank Schäfer
<fschaefer.oss@googlemail.com> wrote:
> Am 30.12.2014 um 13:18 schrieb Yousong Zhou:
>> This patch tries to
>>
>>  - Let the DHCPv6 feature depend on CONFIG_IPV6.
>>  - Conditionally select libnettle, kmod-ipv6, kmod-ipt-ipset only if the
>>    corresponding features are enabled.
>>  - Install `trust-anchors.conf` only if DNSSEC is selected.
>>  - Add PKG_CONFIG_DEPENDS for the configurable options.
>>  - Add a patch to let the Makefile of dnsmasq be aware of changes in
>>    COPTS variable.
>>
>> Big thanks goes to Frank Schäfer <fschaefer.oss@googlemail.com> for
>> providing necessary information on connections and dependency relations
>> between these CONFIGs and packages.
>>
>> Signed-off-by: Yousong Zhou <yszhou4tech@gmail.com>
>> ---
>> v2 <- v1
>>
>>       - Add PKG_CONFIG_DEPENDS variable for better cooperation with OpenWrt build system.
>>       - Patch Makefile of dnsmasq to let it rebuild with changed COPTS variable.
>>       - Rename ipset, IPSET to IPset.
>>       - Break long lines into shorter ones.
>>       - Description text changes with the "configurable" feature in mind.
>>

<snip>

>
> tmp/.config-package.in:93:error: recursive dependency detected!
> tmp/.config-package.in:93:      symbol PACKAGE_dnsmasq-full depends on
> PACKAGE_dnsmasq_full_ipset
> tmp/.config-package.in:124:     symbol PACKAGE_dnsmasq_full_ipset
> depends on PACKAGE_dnsmasq-full
>
> If you make a menuconfig, the IPSET build option also doesn't show up
> unless you have selected DNSSEC...

There are 2 patches in this series, and the first one is needed to
avoid the recursive dependency problem [1] from showing up (it's a
necessary workaround for now).

[1] https://lists.openwrt.org/pipermail/openwrt-devel/2014-December/030211.html

>
> Can you please test your patches before sending them to the list ?
>


>> diff --git a/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>> new file mode 100644
>> index 0000000..663f0e9
>> --- /dev/null
>> +++ b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>> @@ -0,0 +1,42 @@
>> +Index: dnsmasq-2.72/Makefile
>> +===================================================================
>> +--- dnsmasq-2.72.orig/Makefile       2014-12-30 19:46:10.484921940 +0800
>> ++++ dnsmasq-2.72/Makefile    2014-12-30 19:56:39.712926794 +0800
>> +@@ -74,6 +74,10 @@

<snip>

> Urgh... is it really necessary to patch dnsmasqs native Makefile ?
> Can you give us a practical and reproducable example that shows the
> problem you are trying to solve here ?

Patching Makefile of dnsmasq itself is necessary for the build system
of OpenWrt and Makefile of dnsmasq to pick up a possibly updated
config of dnsmasq-full variant.  Otherwise rebuild of dnsmasq-ful may
not happen as expected when users enable or disable a feature with
e.g. make menuconfig.

Regards.

               yousong
Frank Schäfer Jan. 1, 2015, 6:05 p.m. UTC | #3
Hi Yousong,

Am 31.12.2014 um 11:48 schrieb Yousong Zhou:
>
> ...
>> tmp/.config-package.in:93:error: recursive dependency detected!
>> tmp/.config-package.in:93:      symbol PACKAGE_dnsmasq-full depends on
>> PACKAGE_dnsmasq_full_ipset
>> tmp/.config-package.in:124:     symbol PACKAGE_dnsmasq_full_ipset
>> depends on PACKAGE_dnsmasq-full
>>
>> If you make a menuconfig, the IPSET build option also doesn't show up
>> unless you have selected DNSSEC...
> There are 2 patches in this series, and the first one is needed to
> avoid the recursive dependency problem [1] from showing up (it's a
> necessary workaround for now).
>
> [1] https://lists.openwrt.org/pipermail/openwrt-devel/2014-December/030211.html

Ah... ok. Didn't notice that it touches ipset.
Works fine, sorry for the noise.


>>> diff --git a/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>>> new file mode 100644
>>> index 0000000..663f0e9
>>> --- /dev/null
>>> +++ b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>>> @@ -0,0 +1,42 @@
>>> +Index: dnsmasq-2.72/Makefile
>>> +===================================================================
>>> +--- dnsmasq-2.72.orig/Makefile       2014-12-30 19:46:10.484921940 +0800
>>> ++++ dnsmasq-2.72/Makefile    2014-12-30 19:56:39.712926794 +0800
>>> +@@ -74,6 +74,10 @@
> <snip>
>
>> Urgh... is it really necessary to patch dnsmasqs native Makefile ?
>> Can you give us a practical and reproducable example that shows the
>> problem you are trying to solve here ?
> Patching Makefile of dnsmasq itself is necessary for the build system
> of OpenWrt and Makefile of dnsmasq to pick up a possibly updated
> config of dnsmasq-full variant.  Otherwise rebuild of dnsmasq-ful may
> not happen as expected when users enable or disable a feature with
> e.g. make menuconfig.

Ok, I can reproduce it now...
Is this patch suitable for upstream inclusion ?

Regards,
Frank
Yousong Zhou Jan. 4, 2015, 11:22 a.m. UTC | #4
On 2 January 2015 at 02:05, Frank Schäfer <fschaefer.oss@googlemail.com> wrote:
>
> Hi Yousong,
>
> Am 31.12.2014 um 11:48 schrieb Yousong Zhou:
>>
>> ...
>>> tmp/.config-package.in:93:error: recursive dependency detected!
>>> tmp/.config-package.in:93:      symbol PACKAGE_dnsmasq-full depends on
>>> PACKAGE_dnsmasq_full_ipset
>>> tmp/.config-package.in:124:     symbol PACKAGE_dnsmasq_full_ipset
>>> depends on PACKAGE_dnsmasq-full
>>>
>>> If you make a menuconfig, the IPSET build option also doesn't show up
>>> unless you have selected DNSSEC...
>> There are 2 patches in this series, and the first one is needed to
>> avoid the recursive dependency problem [1] from showing up (it's a
>> necessary workaround for now).
>>
>> [1] https://lists.openwrt.org/pipermail/openwrt-devel/2014-December/030211.html
>
> Ah... ok. Didn't notice that it touches ipset.
> Works fine, sorry for the noise.
>
>
>>>> diff --git a/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>>>> new file mode 100644
>>>> index 0000000..663f0e9
>>>> --- /dev/null
>>>> +++ b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>>>> @@ -0,0 +1,42 @@
>>>> +Index: dnsmasq-2.72/Makefile
>>>> +===================================================================
>>>> +--- dnsmasq-2.72.orig/Makefile       2014-12-30 19:46:10.484921940 +0800
>>>> ++++ dnsmasq-2.72/Makefile    2014-12-30 19:56:39.712926794 +0800
>>>> +@@ -74,6 +74,10 @@
>> <snip>
>>
>>> Urgh... is it really necessary to patch dnsmasqs native Makefile ?
>>> Can you give us a practical and reproducable example that shows the
>>> problem you are trying to solve here ?
>> Patching Makefile of dnsmasq itself is necessary for the build system
>> of OpenWrt and Makefile of dnsmasq to pick up a possibly updated
>> config of dnsmasq-full variant.  Otherwise rebuild of dnsmasq-ful may
>> not happen as expected when users enable or disable a feature with
>> e.g. make menuconfig.
>
> Ok, I can reproduce it now...
> Is this patch suitable for upstream inclusion ?
>

An fixed up version of this patch is already in upstream dnsmasq now.
But another one has to be applied to fix possible race condition from
happening when doing parallel build.  I am truly sorry but it seems
like there are just too many cases to be tested out in each iteration.

[1] http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2015q1/009068.html

Regards.

               yousong
Frank Schäfer Jan. 5, 2015, 4:51 p.m. UTC | #5
Am 04.01.2015 um 12:22 schrieb Yousong Zhou:
>>>>> diff --git a/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>>>>> new file mode 100644
>>>>> index 0000000..663f0e9
>>>>> --- /dev/null
>>>>> +++ b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
>>>>> @@ -0,0 +1,42 @@
>>>>> +Index: dnsmasq-2.72/Makefile
>>>>> +===================================================================
>>>>> +--- dnsmasq-2.72.orig/Makefile       2014-12-30 19:46:10.484921940 +0800
>>>>> ++++ dnsmasq-2.72/Makefile    2014-12-30 19:56:39.712926794 +0800
>>>>> +@@ -74,6 +74,10 @@
>>> <snip>
>>>
>>>> Urgh... is it really necessary to patch dnsmasqs native Makefile ?
>>>> Can you give us a practical and reproducable example that shows the
>>>> problem you are trying to solve here ?
>>> Patching Makefile of dnsmasq itself is necessary for the build system
>>> of OpenWrt and Makefile of dnsmasq to pick up a possibly updated
>>> config of dnsmasq-full variant.  Otherwise rebuild of dnsmasq-ful may
>>> not happen as expected when users enable or disable a feature with
>>> e.g. make menuconfig.
>> Ok, I can reproduce it now...
>> Is this patch suitable for upstream inclusion ?
>>
> An fixed up version of this patch is already in upstream dnsmasq now.

Excellent, thanks !

> But another one has to be applied to fix possible race condition from
> happening when doing parallel build.  I am truly sorry but it seems
> like there are just too many cases to be tested out in each iteration.
>
> [1] http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/2015q1/009068.html

Anything I can do to help ?
Which cases need to be tested ?

Regards,
Frank


> Regards.
>
>                yousong
diff mbox

Patch

diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
index 1153428..766aaf0 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -22,6 +22,10 @@  PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSI
 
 PKG_INSTALL:=1
 PKG_BUILD_PARALLEL:=1
+PKG_CONFIG_DEPENDS:=CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dhcpv6 \
+	CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_dnssec \
+	CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_auth \
+	CONFIG_PACKAGE_dnsmasq_$(BUILD_VARIANT)_ipset
 
 include $(INCLUDE_DIR)/package.mk
 
@@ -46,8 +50,10 @@  endef
 
 define Package/dnsmasq-full
 $(call Package/dnsmasq/Default)
-  TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPSET)
-  DEPENDS:=@IPV6 +kmod-ipv6 +libnettle
+  TITLE += (with DNSSEC, DHCPv6, Auth DNS, IPset enabled by default)
+  DEPENDS:=+PACKAGE_dnsmasq_full_dnssec:libnettle \
+	+PACKAGE_dnsmasq_full_dhcpv6:kmod-ipv6 \
+	+PACKAGE_dnsmasq_full_ipset:kmod-ipt-ipset
   VARIANT:=full
 endef
 
@@ -64,7 +70,8 @@  endef
 define Package/dnsmasq-full/description
 $(call Package/dnsmasq/description)
 
-This is a variant with DHCPv6, DNSSEC, Authroitative DNS and IPSET support
+This is a fully configurable variant with DHCPv6, DNSSEC, Authroitative DNS and
+IPset support enabled by default.
 endef
 
 define Package/dnsmasq/conffiles
@@ -72,26 +79,24 @@  define Package/dnsmasq/conffiles
 /etc/dnsmasq.conf
 endef
 
-define Package/dnsmasq/config/Default
-  if PACKAGE_$(1)-$(2)
-  config PACKAGE_dnsmasq_$(2)_dhcpv6
-    bool "Build with DHCPv6 support."
-    default y
-  config PACKAGE_dnsmasq_$(2)_dnssec
-    bool "Build with DNSSEC support."
-    default y
-  config PACKAGE_dnsmasq_$(2)_auth
-    bool "Build with the facility to act as an authoritative DNS server."
-    default y
-  config PACKAGE_dnsmasq_$(2)_ipset
-    bool "Build with ipset support."
-    select PACKAGE_kmod-ipt-ipset
-    default y
-  endif
+define Package/dnsmasq-full/config
+	if PACKAGE_dnsmasq-full
+	config PACKAGE_dnsmasq_full_dhcpv6
+		bool "Build with DHCPv6 support."
+		depends on IPV6
+		default y
+	config PACKAGE_dnsmasq_full_dnssec
+		bool "Build with DNSSEC support."
+		default y
+	config PACKAGE_dnsmasq_full_auth
+		bool "Build with the facility to act as an authoritative DNS server."
+		default y
+	config PACKAGE_dnsmasq_full_ipset
+		bool "Build with IPset support."
+		default y
+	endif
 endef
 
-Package/dnsmasq-full/config=$(call Package/dnsmasq/config/Default,dnsmasq,full)
-
 Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles)
 Package/dnsmasq-full/conffiles = $(Package/dnsmasq/conffiles)
 
@@ -137,8 +142,10 @@  Package/dnsmasq-dhcpv6/install = $(Package/dnsmasq/install)
 
 define Package/dnsmasq-full/install
 $(call Package/dnsmasq/install,$(1))
+ifneq ($(CONFIG_PACKAGE_dnsmasq_full_dnssec),)
 	$(INSTALL_DIR) $(1)/usr/share/dnsmasq
 	$(INSTALL_DATA) $(PKG_BUILD_DIR)/trust-anchors.conf $(1)/usr/share/dnsmasq
+endif
 endef
 
 $(eval $(call BuildPackage,dnsmasq))
diff --git a/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
new file mode 100644
index 0000000..663f0e9
--- /dev/null
+++ b/package/network/services/dnsmasq/patches/200-let-makefile-be-aware-of-config-changes.patch
@@ -0,0 +1,42 @@ 
+Index: dnsmasq-2.72/Makefile
+===================================================================
+--- dnsmasq-2.72.orig/Makefile	2014-12-30 19:46:10.484921940 +0800
++++ dnsmasq-2.72/Makefile	2014-12-30 19:56:39.712926794 +0800
+@@ -74,6 +74,10 @@
+ hdrs = dnsmasq.h config.h dhcp-protocol.h dhcp6-protocol.h \
+        dns-protocol.h radv-protocol.h ip6addr.h
+ 
++COPT_CONF = $(top)/.copt_$(shell $(CC) -DDNSMASQ_COMPILE_OPTS $(COPTS) -E $(top)/$(SRC)/config.h | \
++			( md5sum 2>/dev/null || md5 ) | cut -f 1 -d ' ')
++COPT_CONF_WILD = $(top)/.copt_*
++
+ all : $(BUILDDIR)
+ 	@cd $(BUILDDIR) && $(MAKE) \
+  top="$(top)" \
+@@ -83,7 +87,7 @@
+ 
+ mostly_clean :
+ 	rm -f $(BUILDDIR)/*.mo $(BUILDDIR)/*.pot 
+-	rm -f $(BUILDDIR)/.configured $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq 
++	rm -f $(BUILDDIR)/$(COPT_CONF_WILD) $(BUILDDIR)/*.o $(BUILDDIR)/dnsmasq.a $(BUILDDIR)/dnsmasq
+ 
+ clean : mostly_clean
+ 	rm -f $(BUILDDIR)/dnsmasq_baseline
+@@ -139,7 +143,7 @@
+ 
+ # rules below are targets in recusive makes with cwd=$(BUILDDIR)
+ 
+-.configured: $(hdrs)
++$(COPT_CONF): $(hdrs)
+ 	@rm -f *.o
+ 	@touch $@
+ 
+@@ -149,7 +153,7 @@
+ .c.o:
+ 	$(CC) $(CFLAGS) $(COPTS) $(i18n) $(build_cflags) $(RPM_OPT_FLAGS) -c $<	
+ 
+-dnsmasq : .configured $(hdrs) $(objs)
++dnsmasq : $(COPT_CONF) $(hdrs) $(objs)
+ 	$(CC) $(LDFLAGS) -o $@ $(objs) $(build_libs) $(LIBS) 
+ 
+ dnsmasq.pot : $(objs:.o=.c) $(hdrs)