From 71f311dbe1a3a7d074916b877d74b25d6825ec3d Mon Sep 17 00:00:00 2001 From: George Thessalonikefs Date: Tue, 4 May 2021 14:45:01 +0200 Subject: [PATCH] - Fix for #367: only attempt to get the interface for queries that are no longer on the tcp_waiting_list. --- doc/Changelog | 4 ++++ services/outside_network.c | 10 +++++++--- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/doc/Changelog b/doc/Changelog index ac80f79b5..6edbcf969 100644 --- a/doc/Changelog +++ b/doc/Changelog @@ -1,3 +1,7 @@ +4 May 2021: George + - Fix for #367: only attempt to get the interface for queries that are no + longer on the tcp_waiting_list. + 4 May 2021: Wouter - Merge #478: Allow configuration of TCP timeout while waiting for response. diff --git a/services/outside_network.c b/services/outside_network.c index 5fb4f3faa..a1c18c617 100644 --- a/services/outside_network.c +++ b/services/outside_network.c @@ -2783,8 +2783,12 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, struct comm_reply r2; #ifdef USE_DNSTAP struct waiting_tcp* w = (struct waiting_tcp*)sq->pending; - struct pending_tcp* pend_tcp = (struct pending_tcp*)w->next_waiting; - struct port_if* pi = pend_tcp->pi; + struct pending_tcp* pend_tcp = NULL; + struct port_if* pi = NULL; + if(!w->on_tcp_waiting_list && w->next_waiting) { + pend_tcp = (struct pending_tcp*)w->next_waiting; + pi = pend_tcp->pi; + } #endif sq->pending = NULL; /* removed after this callback */ if(error != NETEVENT_NOERROR) @@ -2797,7 +2801,7 @@ serviced_tcp_callback(struct comm_point* c, void* arg, int error, /* * sending src (local service)/dst (upstream) addresses over DNSTAP */ - if(error==NETEVENT_NOERROR && sq->outnet->dtenv && + if(error==NETEVENT_NOERROR && pi && sq->outnet->dtenv && (sq->outnet->dtenv->log_resolver_response_messages || sq->outnet->dtenv->log_forwarder_response_messages)) { log_addr(VERB_ALGO, "response from upstream", &sq->addr, sq->addrlen); -- 2.39.5