<div dir="ltr"><div>Hello,</div><div><br></div><div>In the source code (commit eb601683820723df89858cfa695aa131012f1a63),</div><div>in function `do_tcp_connection` client connections are checked. At least when options like</div><div>OPT_NOWILD are not enabled.</div><div><br></div><div>The code seems to go through all interfaces reported by the OS and find matching one</div><div>before allowing query to proceed further.</div><div><br></div><div>Following piece of code seems to be responsible for finding matching iface:</div><div><br></div><div>     for (iface = daemon->interfaces; iface; iface = iface->next)<br>       if (iface->index == if_index && iface->addr.sa.sa_family == tcp_addr.sa.sa_family)<br>         break;</div><div><br></div><div>However, in some Kubernetes setups, at least in these which use Calico for</div><div>networking, the network interfaces show up as IPv6, so iface->adrrs.sa.sa_family</div><div>is AF_INET6, but the traffic that goes through is IPv4, so tcp_addr.sa.sa_family</div><div>is AF_INET.</div><div></div><div><br></div><div>Unfortunately I'm not well-educated w.r.t. IPv6, so I don't understand how it's</div><div>all realized, but due to that mismatch, TCP connections are abruptly closed and entire</div><div>downstream fails. In our case it's CoreDNS that considers dnsmasq unhealthy and</div><div>bombards it with health checks NS <Root>.</div><div><br></div><div>Now, this can be fixed by using bind-interfaces/-z, but that seems to be bad choice,</div><div>as per the manual, which reads:</div><div><br></div><div>> About the only time when this is useful is when running another nameserver</div><div>> (or another instance of dnsmasq) on the same machine.</div><div><br></div><div>My question is whether the AF_INET/AF_INET6 mismatch is handled correctly?</div><div>Shouldn't dnsmasq allow ipv4 queries originating from inet6 ifaces?</div><div><br></div><div>An if not, I assume that workaround should be placed elsewhere?</div><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div>Best Regards, Sławomir Zborowski</div></div></div></div>