[Dnsmasq-discuss] [PATCH] Two small fixes
Dominik Derigs
dl6er at dl6er.de
Fri Nov 19 10:21:55 UTC 2021
Hey Petr,
while Simon is still away, we can discuss this a little further.
On Wed, 2021-09-29 at 22:48 +0200, Petr Menšík wrote:
> If no --bind-interface is given, iface->name pointing to eth0
> rather
> than eth0:0 is correct. Alias is useful only for reading of the
> address
> from the interface name. Otherwise it works as the interface
> itself.
> Thas was reason behind warn_bound_listeners creation. When
> incoming
> packet is checked for acceptance, it is compared to primary
> interface
> identified by ifindex. I think we may even remove name from
> struct irec
> and get the name on few places it needs to be printed. It makes
> debugging more comfortable, but is not required anyway.
I checked once again why I created the patch initially and found
the following bug/misbehavior (whatever you wanna call it):
Real interface is eth0. an alias is created as eth0:0
1. Config --interface=eth0
Queries on eth0 and eth0:0 are accepted because dnsmasq only
compares the physical interface name string.
2. Config --interface=eth0:0
Queries on eth0 and eth0:0 are rejected (at first!) because of
the physical interface's name mismatch. But there is another
check "label_expection()" that does said iteration and would lead
to accepting the eth0:0 query. The eth0 query is correctly
rejected.
In an ideal world, we should reject also the eth0:0 query when
configured with "--interface=eth0". It can rather easily be done
when comparing the configured interface's IP addresses instead of
the name strings (or ifindex).
When doing this, the warn_wild_listeners() can be dropped
altogether as the strange behavior we used to warn about is
fixed.
I addressed this in the attached patch and would appreciate if
you could take a look (I don't want to break any other features).
The patch isn't highly optimized but prepared for readability.
Best,
Dominik
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Don-t-accept-queries-ariving-on-alias-interface-if-c.patch
Type: text/x-patch
Size: 5120 bytes
Desc: not available
URL: <http://lists.thekelleys.org.uk/pipermail/dnsmasq-discuss/attachments/20211119/4333ed9b/attachment-0001.bin>
More information about the Dnsmasq-discuss
mailing list