mirror of
https://github.com/zeek/zeek.git
synced 2025-10-10 10:38:20 +00:00
Fix timing out DNS lookups that were already resolved
This could happen in the case of making repeated lookup requests for the same thing within a short period of time: cleaning up an old request that already got resolved would mistakenly see a new, yet-to-be-resolved request with identical host/addr and mistakenly assume it's in need of being timed out.
This commit is contained in:
parent
fd11c63efe
commit
46799f7540
2 changed files with 15 additions and 8 deletions
|
@ -1407,12 +1407,15 @@ void DNS_Mgr::DoProcess()
|
||||||
if ( req->time + DNS_TIMEOUT > current_time() )
|
if ( req->time + DNS_TIMEOUT > current_time() )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if ( req->IsAddrReq() )
|
if ( ! req->processed )
|
||||||
CheckAsyncAddrRequest(req->host, true);
|
{
|
||||||
else if ( req->is_txt )
|
if ( req->IsAddrReq() )
|
||||||
CheckAsyncTextRequest(req->name.c_str(), true);
|
CheckAsyncAddrRequest(req->host, true);
|
||||||
else
|
else if ( req->is_txt )
|
||||||
CheckAsyncHostRequest(req->name.c_str(), true);
|
CheckAsyncTextRequest(req->name.c_str(), true);
|
||||||
|
else
|
||||||
|
CheckAsyncHostRequest(req->name.c_str(), true);
|
||||||
|
}
|
||||||
|
|
||||||
asyncs_timeouts.pop();
|
asyncs_timeouts.pop();
|
||||||
delete req;
|
delete req;
|
||||||
|
|
|
@ -172,12 +172,13 @@ protected:
|
||||||
|
|
||||||
struct AsyncRequest {
|
struct AsyncRequest {
|
||||||
double time;
|
double time;
|
||||||
|
bool is_txt;
|
||||||
|
bool processed;
|
||||||
IPAddr host;
|
IPAddr host;
|
||||||
string name;
|
string name;
|
||||||
bool is_txt;
|
|
||||||
CallbackList callbacks;
|
CallbackList callbacks;
|
||||||
|
|
||||||
AsyncRequest() : time(0.0), is_txt(false) { }
|
AsyncRequest() : time(0.0), is_txt(false), processed(false) { }
|
||||||
|
|
||||||
bool IsAddrReq() const { return name.length() == 0; }
|
bool IsAddrReq() const { return name.length() == 0; }
|
||||||
|
|
||||||
|
@ -190,6 +191,7 @@ protected:
|
||||||
delete *i;
|
delete *i;
|
||||||
}
|
}
|
||||||
callbacks.clear();
|
callbacks.clear();
|
||||||
|
processed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Resolved(TableVal* addrs)
|
void Resolved(TableVal* addrs)
|
||||||
|
@ -201,6 +203,7 @@ protected:
|
||||||
delete *i;
|
delete *i;
|
||||||
}
|
}
|
||||||
callbacks.clear();
|
callbacks.clear();
|
||||||
|
processed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timeout()
|
void Timeout()
|
||||||
|
@ -212,6 +215,7 @@ protected:
|
||||||
delete *i;
|
delete *i;
|
||||||
}
|
}
|
||||||
callbacks.clear();
|
callbacks.clear();
|
||||||
|
processed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue