Compare commits

..
2 Commits
Author SHA1 Message Date
Simon Kelley f9f8d19bf5 Yet another 0x20 fix.
To complement the previous one, which fixed the retry path
when the query is retried from a different id/source address, this
fixes retries from the same id/source address.
2025-02-09 11:06:59 +00:00
Simon Kelley 535be2f5d3 Fix possible SIGSEGV in bpf.c 2025-02-08 22:58:42 +00:00
2 changed files with 11 additions and 15 deletions

No files matched your search

+1 -3
View File
@@ -125,12 +125,11 @@ int iface_enumerate(int family, void *parm, callback_t callback)
#endif #endif
for (addrs = head; addrs; addrs = addrs->ifa_next) for (addrs = head; addrs; addrs = addrs->ifa_next)
{
if (addrs->ifa_addr->sa_family == family)
{ {
int iface_index = if_nametoindex(addrs->ifa_name); int iface_index = if_nametoindex(addrs->ifa_name);
if (iface_index == 0 || !addrs->ifa_addr || if (iface_index == 0 || !addrs->ifa_addr ||
addrs->ifa_addr->sa_family != family ||
(!addrs->ifa_netmask && family != AF_LINK)) (!addrs->ifa_netmask && family != AF_LINK))
continue; continue;
@@ -228,7 +227,6 @@ int iface_enumerate(int family, void *parm, callback_t callback)
} }
#endif #endif
} }
}
ret = 1; ret = 1;
+10 -12
View File
@@ -199,10 +199,15 @@ static void forward_query(int udpfd, union mysockaddr *udpaddr,
struct frec_src *src; struct frec_src *src;
unsigned int casediff = 0; unsigned int casediff = 0;
unsigned int *bitvector = NULL; unsigned int *bitvector = NULL;
unsigned short id; unsigned short id = ntohs(header->id); /* Retrieve the id from the new query before we overwrite it. */
/* Get the case-scambled version of the query to resend. This is important because we
may fall through below and forward the query in the packet buffer again and we
want to use the same case scrambling as the first time. */
blockdata_retrieve(forward->stash, forward->stash_len, (void *)header);
for (src = &forward->frec_src; src; src = src->next) for (src = &forward->frec_src; src; src = src->next)
if (src->orig_id == ntohs(header->id) && if (src->orig_id == id &&
sockaddr_isequal(&src->source, udpaddr)) sockaddr_isequal(&src->source, udpaddr))
break; break;
@@ -255,17 +260,10 @@ static void forward_query(int udpfd, union mysockaddr *udpaddr,
Note the two names are guaranteed to be the same length and differ only in the case Note the two names are guaranteed to be the same length and differ only in the case
of letters at this point. of letters at this point.
Get the original query into the packet buffer and extract the query name it contains The original query we sent is now in packet buffer and the query name in the
to calculate the difference in case scrambling. This is important because we new instance is on daemon->namebuff. */
may fall through below and forward the query in the packet buffer again and we
want to use the same case scrambling as the first time.
Retrieve the id from the new query before we overwrite it. */ if (extract_request(header, forward->stash_len, daemon->workspacename, NULL))
id = ntohs(header->id);
if (blockdata_retrieve(forward->stash, forward->stash_len, (void *)header) &&
extract_request(header, forward->stash_len, daemon->workspacename, NULL))
{ {
unsigned int i, gobig = 0; unsigned int i, gobig = 0;
char *s1, *s2; char *s1, *s2;