diff --git a/CHANGES b/CHANGES index c78bf13245..1794815e76 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,22 @@ +6.1.0-dev.364 | 2023-09-05 19:56:59 +0200 + + * DNS_Mgr: Use Process() for timeout expiration (Arne Welzel, Corelight) + + DNS_Mgr has a GetNextTimeout() implementation that may return 0.0. When + that is the case, its IO source is enqueued as ready with an fd of -1. + This in turn results in Process() being called instead of ProcessFd() + in RunState.cc. + + Ensure timeouts behavior is properly handled by actually forwarding + timeout indications to c-ares via DNS_Mgr::Process(). This results + in pending DNS queries for which a timeout happened to actually + timeout (when there's no other connectivity). + + * DNS_Mgr: Fix GetNextTimeout() returning absolute values (Arne Welzel, Corelight) + + Not sure, must have been some sort of left-over, but wasn't really + effective due to Process() not being implemented. + 6.1.0-dev.361 | 2023-09-04 14:00:37 +0200 * Fix check for emailed notices (Justin Azoff, Corelight) diff --git a/VERSION b/VERSION index f057ef5b85..c3fb06942f 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -6.1.0-dev.361 +6.1.0-dev.364 diff --git a/src/DNS_Mgr.cc b/src/DNS_Mgr.cc index 04db081327..9b06eb3f8b 100644 --- a/src/DNS_Mgr.cc +++ b/src/DNS_Mgr.cc @@ -1456,8 +1456,7 @@ double DNS_Mgr::GetNextTimeout() struct timeval* tvp = ares_timeout(channel, &tv, &tv); - return run_state::network_time + static_cast(tvp->tv_sec) + - (static_cast(tvp->tv_usec) / 1e6); + return static_cast(tvp->tv_sec) + (static_cast(tvp->tv_usec) / 1e6); } void DNS_Mgr::ProcessFd(int fd, int flags) @@ -1472,6 +1471,15 @@ void DNS_Mgr::ProcessFd(int fd, int flags) IssueAsyncRequests(); } +void DNS_Mgr::Process() + { + // Process() is called when DNS_Mgr is found "ready" when its + // GetNextTimeout() returns 0.0, but there's no active FD. + // + // Kick off timeouts at least. + ares_process_fd(channel, ARES_SOCKET_BAD, ARES_SOCKET_BAD); + } + void DNS_Mgr::GetStats(Stats* stats) { // TODO: can this use the telemetry framework? diff --git a/src/DNS_Mgr.h b/src/DNS_Mgr.h index 97ca1c23f8..5f87313e95 100644 --- a/src/DNS_Mgr.h +++ b/src/DNS_Mgr.h @@ -285,7 +285,7 @@ protected: void IssueAsyncRequests(); // IOSource interface. - void Process() override { } + void Process() override; void ProcessFd(int fd, int flags) override; void InitSource() override; const char* Tag() override { return "DNS_Mgr"; }