dnsmasq: Support add-mac option
authorHans Dedecker <dedeckeh@gmail.com>
Thu, 3 Nov 2016 20:44:29 +0000 (21:44 +0100)
committerJohn Crispin <john@phrozen.org>
Tue, 8 Nov 2016 10:17:10 +0000 (11:17 +0100)
Adds the mac address of the DNS requestor to DNS queries which
are forwarded upstream and can be used to do filtering by the
upstream servers. This only works if the requestor is on the
same subnet as the dnsmasq server

The addmac parameter can hold the following values:
0 : mac address is not added
1 : mac address is added in binary format
base64 : mac address is added base64 encoded
text: : mac address is added in human readable format
as hex and colons

Signed-off-by: Hans Dedecker <dedeckeh@gmail.com>
package/network/services/dnsmasq/Makefile
package/network/services/dnsmasq/files/dnsmasq.init

index 804242f4e169fa39726addbdc27421daef5af1e5..861cda7fbe57705f8a5e09a584f61720d1836987 100644 (file)
@@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=dnsmasq
 PKG_VERSION:=2.76
-PKG_RELEASE:=4
+PKG_RELEASE:=5
 
 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.xz
 PKG_SOURCE_URL:=http://thekelleys.org.uk/dnsmasq
index 76128301037cd8c4b1387fce532cacabf4d0f1a1..b1f9e2e29010c4a5e06f6dc2bc8ccaa3fd022deb 100644 (file)
@@ -660,6 +660,12 @@ dnsmasq_start()
                append_bool "$cfg" dnsseccheckunsigned "--dnssec-check-unsigned"
        }
 
+       config_get addmac "$cfg" addmac 0
+       [ "$addmac" != "0" ] && {
+               [ "$addmac" = "1" ] && addmac=
+               xappend "--add-mac${addmac:+="$addmac"}"
+       }
+
        dhcp_option_add "$cfg" "" 0
 
        xappend "--dhcp-broadcast=tag:needs-broadcast"