[OpenWrt-Devel] [PATCH][package] Allow UCI dhcp classifier to accept a list of MAC

nworbnhoj nworbnhoj at gmail.com
Mon Jan 18 16:29:08 EST 2016


dnsmasq offers to group DHCP options and their values by a network-id
and to send options only to hosts which have been tagged with that
network-id.

uci acceps the mac classifier, but only for a single MAC
config mac 'opnvpn'
        option mac  '00:FF:*:*:*:*'
        option networkid   'opnvpn'
        list   dhcp_option '3'

this patch allows a list of macs to be assigned to a network-id
config mac 'opnvpn'
	list   mac  '00:00:00:00:00:AA'
	list   mac  '00:00:00:00:00:BB'
	list   mac  '00:00:00:00:00:CC'
        option networkid   'opnvpn'
        list   dhcp_option '3'

Signed-off-by: John A Brown <nworbnhoj at gmail.com>
---
 package/network/services/dnsmasq/files/dnsmasq.init | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
index efc9627..c265e01 100644
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -363,7 +363,9 @@ dhcp_mac_add() {
 	config_get mac "$cfg" mac
 	[ -n "$mac" ] || return 0
 
-	xappend "--dhcp-mac=$networkid,$mac"
+	for o in $mac; do
+		xappend "--dhcp-mac=$networkid,$mac"
+	done
 
 	dhcp_option_add "$cfg" "$networkid"
 }
-- 
2.5.0
_______________________________________________
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