[Dnsmasq-discuss] [PATCH] Two small fixes

Dominik Derigs dl6er at dl6er.de
Wed Sep 29 17:45:43 UTC 2021

Hey Petr and Simon,

I tried it with a temporary label and it seems to have worked. But I might
not have tested the right things.

On Wed, 2021-09-29 at 12:55 +0200, Petr Menšík wrote:
> I think there was issue with indextoname converting arrival packet index
> to a name. If it were not marked as label and handled special way,
> incoming packet never matched eth0:0 interface name, because only eth0
> got reported as incoming interface.

Makes sense, if_indextoname() is likely not working here because labels
have the same index as the "root" device.

On Wed, 2021-09-29 at 12:55 +0200, Petr Menšík wrote:
> Not worth changing unless we know for sure we want/need it.

I see. However, I did just check again where "iface->name" is actually used
and we never compare it to anything. In all cases (did I miss some?), it is
only for displaying like

> my_syslog(LOG_DEBUG|MS_DEBUG, _("listening on %s(#%d): %s port %d"),
>           iface->name, iface->index, daemon->addrbuff, port);


> my_syslog(LOG_ERR, s, iface->name, strerror(errno));

so having the correct label showing up here would be helpful and I think no
behavior should be changed when we edit warn_bound_listeners()
and warn_wild_labels() to strip the label suffix, something like

> printf("%.*s\n", strcspn(label, ":"), label);

will should work without any need for a buffer variable.

I should mention that this change was not started because of just the
change but we are using the interfaces struct also somewhere else in the
Pi-hole daemon that embedds dnsmasq to support a few interface-dependent
things (like answering based on arriving interface). This is currently
broken because we cannot distinguish virtual from real interfaces due to
the missing label. Not that this should be the reason for making this
change. This reasoning is given above (correct warnings in dnsmasq).


More information about the Dnsmasq-discuss mailing list