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 <[email protected]>
---
 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
[email protected]
https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel

Reply via email to