mirror of
https://github.com/pi-hole/dnsmasq.git
synced 2025-12-19 10:18:25 +00:00
Fix --localise-queries via interface lo bug.
This commit is contained in:
@@ -71,6 +71,11 @@ version 2.60
|
||||
configuration from the DHCPv6 conf, and should just need
|
||||
enabling with --enable-ra.
|
||||
|
||||
Fix long-standing wrinkle with --localise-queries that
|
||||
could result in wrong answers when DNS packets arrive
|
||||
via an interface other than the expected one. Thanks to
|
||||
Lorenzo Milesi and John Hanks for spotting this one.
|
||||
|
||||
|
||||
version 2.59
|
||||
Fix regression in 2.58 which caused failure to start up
|
||||
|
||||
@@ -766,12 +766,33 @@ void receive_query(struct listener *listen, time_t now)
|
||||
!iface_check(listen->family, &dst_addr, ifr.ifr_name))
|
||||
return;
|
||||
|
||||
if (listen->family == AF_INET &&
|
||||
option_bool(OPT_LOCALISE) &&
|
||||
ioctl(listen->fd, SIOCGIFNETMASK, &ifr) == -1)
|
||||
return;
|
||||
if (listen->family == AF_INET && option_bool(OPT_LOCALISE))
|
||||
{
|
||||
struct irec *iface;
|
||||
|
||||
netmask = ((struct sockaddr_in *) &ifr.ifr_addr)->sin_addr;
|
||||
/* get the netmask of the interface whch has the address we were sent to.
|
||||
This is no neccessarily the interface we arrived on. */
|
||||
|
||||
for (iface = daemon->interfaces; iface; iface = iface->next)
|
||||
if (iface->addr.sa.sa_family == AF_INET &&
|
||||
iface->addr.in.sin_addr.s_addr == dst_addr_4.s_addr)
|
||||
break;
|
||||
|
||||
/* interface may be new */
|
||||
if (!iface)
|
||||
enumerate_interfaces();
|
||||
|
||||
for (iface = daemon->interfaces; iface; iface = iface->next)
|
||||
if (iface->addr.sa.sa_family == AF_INET &&
|
||||
iface->addr.in.sin_addr.s_addr == dst_addr_4.s_addr)
|
||||
break;
|
||||
|
||||
/* If we failed, abandon localisation */
|
||||
if (iface)
|
||||
netmask = iface->netmask;
|
||||
else
|
||||
dst_addr_4.s_addr = 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (extract_request(header, (size_t)n, daemon->namebuff, &type))
|
||||
|
||||
Reference in New Issue
Block a user