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

Delay IPv6 client name lookups #2130

Draft
wants to merge 1 commit into
base: development
Choose a base branch
from
Draft
Show file tree
Hide file tree
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
6 changes: 6 additions & 0 deletions src/FTL.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,12 @@
// Default: 30 (seconds)
#define QPS_AVGLEN 30

// How long should IPv6 client host name resolution be postponed?
// This is done to ensure that the network table had time to catch up on new
// clients in the network
// Default: 2 x database.DBinterval (seconds) = 120 s
#define DELAY_V6_RESOLUTION 2*config.database.DBinterval.v.ui

// Use out own syscalls handling functions that will detect possible errors
// and report accordingly in the log. This will make debugging FTL crash
// caused by insufficient memory or by code bugs (not properly dealing
Expand Down
15 changes: 15 additions & 0 deletions src/resolve.c
Original file line number Diff line number Diff line change
Expand Up @@ -895,6 +895,21 @@ static void resolveClients(const bool onlynew, const bool force_refreshing)
if((ipaddr = getstr(ippos)) != NULL && strstr(ipaddr,":") != NULL)
IPv6 = true;

// If onlynew flag is set, we will only resolve new clients.
// However, if this is a IPv6 client, we postpone the resolution
// slightly to ensure the network table has had time to possibly
// correlate the IPv6 address via a related other address (e.g.,
// IPv4 address) though an identical MAC address.
if(onlynew && newflag && IPv6 && client->firstSeen + DELAY_V6_RESOLUTION > now)
{
log_debug(DEBUG_RESOLVER, "Postponing resolution of new client %s (IPv6) for at least %.0f more seconds",
getstr(ippos), now - client->firstSeen + DELAY_V6_RESOLUTION);

unlock_shm();
skipped++;
continue;
}

unlock_shm();

// If we're in refreshing mode (onlynew == false), we skip clients if
Expand Down
Loading