Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix first-time IPv6 client name resolution #2310

Merged
merged 1 commit into from
Mar 3, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/resolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -868,7 +868,7 @@ static size_t resolveAndAddHostname(const int udp_sock, struct sockaddr_in *dest
// Resolve client host names
static void resolveClients(const bool onlynew, const bool force_refreshing)
{
const time_t now = time(NULL);
const double now = double_time();
// Lock counter access here, we use a copy in the following loop
lock_shm();
const unsigned int clientscount = counters->clients;
Expand Down Expand Up @@ -962,7 +962,14 @@ static void resolveClients(const bool onlynew, const bool force_refreshing)
// 2. We should only refresh IPv4 client, but this client is IPv6
// 3. We should only refresh unknown hostnames, but leave
// existing ones as they are
if(onlynew == false &&
//
// We do not skip here clients which are
// - still new,
// - IPv6, and
// - need to be resolved
const bool new_ipv6_needs_resolve = newflag && IPv6 && client->firstSeen + DELAY_V6_RESOLUTION <= now;

if(onlynew == false && !new_ipv6_needs_resolve &&
(config.resolver.refreshNames.v.refresh_hostnames == REFRESH_NONE ||
(config.resolver.refreshNames.v.refresh_hostnames == REFRESH_IPV4_ONLY && IPv6) ||
(config.resolver.refreshNames.v.refresh_hostnames == REFRESH_UNKNOWN && oldnamepos != 0)))
Expand Down
Loading