Hey Simon, this is alternative PR to previously submitted patch (title "Don't accept queries arriving on alias interface if configured not to do this "). In contrast to the other patch, this one does not fix the bug of listening on both interfaces when asked only to listen on the alias interface (see other PR for details). Instead, it only adds logging for which interface is actually used when a different was configured.
I personally prefer the other fix as this one would be a mere bandaid and not fixing the actual issue. Best, Dominik
From 33605d70b01f0ae2c60112d12c43762032865502 Mon Sep 17 00:00:00 2001 From: Dominik Derigs <dl...@dl6er.de> Date: Sun, 26 Dec 2021 10:29:14 +0100 Subject: [PATCH 1/2] Log which interface is actually used when a different was configured Signed-off-by: DL6ER <dl...@dl6er.de> --- src/dnsmasq.h | 2 +- src/network.c | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/dnsmasq.h b/src/dnsmasq.h index 1b00298..7af973c 100644 --- a/src/dnsmasq.h +++ b/src/dnsmasq.h @@ -632,7 +632,7 @@ struct irec { union mysockaddr addr; struct in_addr netmask; /* only valid for IPv4 */ int tftp_ok, dhcp_ok, mtu, done, warned, dad, dns_auth, index, multicast_done, found, label; - char *name; + char *name, *slabel; struct irec *next; }; diff --git a/src/network.c b/src/network.c index 3c1c176..e3879cf 100644 --- a/src/network.c +++ b/src/network.c @@ -544,9 +544,11 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label, iface->done = iface->multicast_done = iface->warned = 0; iface->index = if_index; iface->label = is_label; - if ((iface->name = whine_malloc(strlen(ifr.ifr_name)+1))) + if ((iface->slabel = whine_malloc(strlen(label)+1)) && + (iface->name = whine_malloc(strlen(ifr.ifr_name)+1))) { strcpy(iface->name, ifr.ifr_name); + strcpy(iface->slabel, label); iface->next = daemon->interfaces; daemon->interfaces = iface; return 1; @@ -1221,7 +1223,7 @@ void warn_wild_labels(void) for (iface = daemon->interfaces; iface; iface = iface->next) if (iface->found && iface->name && iface->label) - my_syslog(LOG_WARNING, _("warning: using interface %s instead"), iface->name); + my_syslog(LOG_WARNING, _("warning: using interface %s instead of %s"), iface->name, iface->slabel); } void warn_int_names(void) -- 2.25.1
From f48372b12f45ff808e0a6e2c4a93f940171816e9 Mon Sep 17 00:00:00 2001 From: Dominik Derigs <dl...@dl6er.de> Date: Sun, 26 Dec 2021 10:35:00 +0100 Subject: [PATCH 2/2] Compare label instead of interface name against dhcp_except and tftp interfaces to extend their scope to interface aliases. The man page does not mention that they are limited to "real" interfaces and stop working once an alias interface is specified (even if valid). Signed-off-by: DL6ER <dl...@dl6er.de> --- src/network.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/network.c b/src/network.c index e3879cf..9f4917b 100644 --- a/src/network.c +++ b/src/network.c @@ -506,7 +506,7 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label, } else for (tmp = daemon->dhcp_except; tmp; tmp = tmp->next) - if (tmp->name && wildcard_match(tmp->name, ifr.ifr_name)) + if (tmp->name && wildcard_match(tmp->name, label)) { tftp_ok = 0; dhcp_ok = 0; @@ -520,7 +520,7 @@ static int iface_allowed(struct iface_param *param, int if_index, char *label, /* dedicated tftp interface list */ tftp_ok = 0; for (tmp = daemon->tftp_interfaces; tmp; tmp = tmp->next) - if (tmp->name && wildcard_match(tmp->name, ifr.ifr_name)) + if (tmp->name && wildcard_match(tmp->name, label)) tftp_ok = 1; } #endif -- 2.25.1
_______________________________________________ Dnsmasq-discuss mailing list Dnsmasq-discuss@lists.thekelleys.org.uk https://lists.thekelleys.org.uk/cgi-bin/mailman/listinfo/dnsmasq-discuss