OpenWrt Forum Archive

Topic: trunk - dnsmasq enable ipset

The content of this topic has been archived on 28 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Dear all

I will ask a very stupid question, but I am struggling to have dnsmasq with ipset enabled. Is there somewhere I can find the package with ipset enabled? If not how do I set HAVE_IPSET?

kind regards
Steve

dear all
I managed to built it with ipset by changing the makefile in the trunk and remove dno_ipset.
Now I am stuck on adding it to /var/etc/dnsmasq.conf.
Can I easily add it?

kind regards
Steve

Hi,

  I needed to change the dnsmasq Makefile, init and config files. Something like the following:

diff --git a/package/network/services/dnsmasq/Makefile b/package/network/services/dnsmasq/Makefile
index 0673465..6761de6 100644
--- a/package/network/services/dnsmasq/Makefile
+++ b/package/network/services/dnsmasq/Makefile
@@ -63,7 +63,7 @@ Package/dnsmasq-dhcpv6/conffiles = $(Package/dnsmasq/conffiles)

TARGET_CFLAGS += \
        -ffunction-sections -fdata-sections \
-       $(if $(CONFIG_IPV6),,-DNO_IPV6) -DNO_IPSET -DNO_AUTH
+       $(if $(CONFIG_IPV6),,-DNO_IPV6) -DNO_AUTH

ifeq ($(BUILD_VARIANT),nodhcpv6)
   TARGET_CFLAGS += -DNO_DHCP6
diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index b5fb58c..5005363 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -83,6 +83,10 @@ append_address() {
        xappend "--address=$1"
}

+append_ipset() {
+       xappend "--ipset=$1"
+}
+
append_interface() {
        local ifname=$(uci_get_state network "$1" ifname "$1")
        xappend "--interface=$ifname"
@@ -133,6 +137,7 @@ dnsmasq() {
        append_parm "$cfg" "local" "--server"
        config_list_foreach "$cfg" "server" append_server
        config_list_foreach "$cfg" "address" append_address
+       config_list_foreach "$cfg" "ipset" append_ipset
        config_list_foreach "$cfg" "interface" append_interface
        config_list_foreach "$cfg" "notinterface" append_notinterface
        config_list_foreach "$cfg" "addnhosts" append_addnhosts

  For the config file (/etc/config/dhcp) I needed to include: list ipset '/google.com/wgarden'.

  So, when dnsmasq resolves some "google.com" domain it adds an ip address to my "wgarden" ipset set.

  I hope it helped you.

[]s
Ronaldo

The discussion might have continued from here.