Fix DNSSEC work counting when swapping from UDP to TCP

This commit is contained in:
Simon Kelley
2024-09-23 16:45:12 +01:00
parent f5cdb007d8
commit e9a7cd0a50
4 changed files with 26 additions and 4 deletions

View File

@@ -896,7 +896,8 @@ int cache_recv_insert(time_t now, int fd)
Restart UDP validation process with the returned result. */
if (m == -2)
{
int status, uid;
int status, uid, keycount, validatecount;
int *keycountp, *validatecountp;
struct frec *forward;
if (!read_write(fd, (unsigned char *)&status, sizeof(status), 1))
@@ -905,13 +906,27 @@ int cache_recv_insert(time_t now, int fd)
return 0;
if (!read_write(fd, (unsigned char *)&uid, sizeof(uid), 1))
return 0;
if (!read_write(fd, (unsigned char *)&keycount, sizeof(keycount), 1))
return 0;
if (!read_write(fd, (unsigned char *)&keycountp, sizeof(keycountp), 1))
return 0;
if (!read_write(fd, (unsigned char *)&validatecount, sizeof(validatecount), 1))
return 0;
if (!read_write(fd, (unsigned char *)&validatecountp, sizeof(validatecountp), 1))
return 0;
/* There's a tiny chance that the frec may have been freed
and reused before the TCP process returns. Detect that with
the uid field which is unique modulo 2^32 for each use. */
if (uid == forward->uid)
pop_and_retry_query(forward, status, now);
{
/* repatriate the work counters from the child process. */
*keycountp = keycount;
*validatecountp = validatecount;
pop_and_retry_query(forward, status, now);
}
return 1;
}
#endif