diff mbox series

dnsmasq: add match_tag for --dhcp-host

Message ID 20210923072845.22602-1-fercerpav@gmail.com
State Accepted
Headers show
Series dnsmasq: add match_tag for --dhcp-host | expand

Commit Message

Paul Fertser Sept. 23, 2021, 7:28 a.m. UTC
A set of tags can be specified for --dhcp-host option to restrict the
assignment to the requests which match all the tags.

Example usage:

config vendorclass
        option networkid 'udhcp'
        option vendorclass 'udhcp'

config host
        option mac '*:*:*:*:*:*'
        list match_tag 'switch.10'
        list match_tag 'udhcp'
        option ip '192.168.25.10'

Signed-off-by: Paul Fertser <fercerpav@gmail.com>
---
 package/network/services/dnsmasq/files/dnsmasq.init | 11 ++++++++---
 1 file changed, 8 insertions(+), 3 deletions(-)
 mode change 100644 => 100755 package/network/services/dnsmasq/files/dnsmasq.init

Comments

Paul D Sept. 23, 2021, 9:24 a.m. UTC | #1
Did not understand significance of vendorclass.

Should this give a new option for uci, match_tag?



On 2021-09-23 09:28, Paul Fertser wrote:
> A set of tags can be specified for --dhcp-host option to restrict the
> assignment to the requests which match all the tags.
> 
> Example usage:
> 
> config vendorclass
>          option networkid 'udhcp'
>          option vendorclass 'udhcp'
> 
> config host
>          option mac '*:*:*:*:*:*'
>          list match_tag 'switch.10'
>          list match_tag 'udhcp'
>          option ip '192.168.25.10'
>
Kevin 'ldir' Darbyshire-Bryant Nov. 9, 2021, 4:45 p.m. UTC | #2
The sender domain has a DMARC Reject/Quarantine policy which disallows
sending mailing list messages using the original "From" header.

To mitigate this problem, the original message has been wrapped
automatically by the mailing list software.
Merged into my staging tree.
Thank you!
diff mbox series

Patch

diff --git a/package/network/services/dnsmasq/files/dnsmasq.init b/package/network/services/dnsmasq/files/dnsmasq.init
old mode 100644
new mode 100755
index 9748c09b8ee8..bea0bc02a2da
--- a/package/network/services/dnsmasq/files/dnsmasq.init
+++ b/package/network/services/dnsmasq/files/dnsmasq.init
@@ -332,7 +332,7 @@  dhcp_match_add() {
 
 dhcp_host_add() {
 	local cfg="$1"
-	local hosttag nametime addrs duids macs tags
+	local hosttag nametime addrs duids macs tags mtags
 
 	config_get_bool force "$cfg" force 0
 
@@ -357,6 +357,11 @@  dhcp_host_add() {
 	config_get duid "$cfg" duid
 	config_get tag "$cfg" tag
 
+	add_tag() {
+		mtags="${mtags}tag:$1,"
+	}
+	config_list_foreach "$cfg" match_tag add_tag
+
 	if [ -n "$mac" ]; then
 		# --dhcp-host=00:20:e0:3b:13:af,192.168.0.199,lap
 		# many MAC are possible to track a laptop ON/OFF dock
@@ -394,9 +399,9 @@  dhcp_host_add() {
 
 	if [ $DNSMASQ_DHCP_VER -eq 6 ]; then
 		addrs="${ip:+,$ip}${hostid:+,[::$hostid]}"
-		xappend "--dhcp-host=$macs${duids:+,$duids}$hosttag$addrs$nametime"
+		xappend "--dhcp-host=$mtags$macs${duids:+,$duids}$hosttag$addrs$nametime"
 	else
-		xappend "--dhcp-host=$macs$hosttag${ip:+,$ip}$nametime"
+		xappend "--dhcp-host=$mtags$macs$hosttag${ip:+,$ip}$nametime"
 	fi
 }