]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
Use port_if pointer instead of wrong UDP local addr
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 9 Dec 2020 11:13:50 +0000 (12:13 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Wed, 9 Dec 2020 11:13:50 +0000 (12:13 +0100)
services/outside_network.c

index 027f18ce5320b3247c6f10d9a855367d93bf0050..1854e5dac7d6c6a24d53bf484ae843992715a13c 100644 (file)
@@ -2891,6 +2891,10 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
        struct serviced_query* sq = (struct serviced_query*)arg;
        struct outside_network* outnet = sq->outnet;
        struct timeval now = *sq->outnet->now_tv;
+#ifdef USE_DNSTAP
+       struct pending* p = (struct pending*)sq->pending;
+       struct port_if* pi = p->pc->pif;
+#endif
 
        sq->pending = NULL; /* removed after callback */
        if(error == NETEVENT_TIMEOUT) {
@@ -2934,19 +2938,11 @@ serviced_udp_callback(struct comm_point* c, void* arg, int error,
        if(error == NETEVENT_NOERROR && outnet->dtenv &&
           (outnet->dtenv->log_resolver_response_messages ||
            outnet->dtenv->log_forwarder_response_messages)) {
-               if(addr_is_ip6(&sq->addr, sq->addrlen)) {
-                       log_addr(VERB_ALGO, "response from upstream", &sq->addr, sq->addrlen);
-                       log_addr(VERB_ALGO, "to local addr", &sq->outnet->ip6_ifs->addr, sq->outnet->ip6_ifs->addrlen);
-                       dt_msg_send_outside_response(outnet->dtenv, &sq->addr, &sq->outnet->ip6_ifs->addr, c->type,
-                         sq->zone, sq->zonelen, sq->qbuf, sq->qbuflen,
-                         &sq->last_sent_time, sq->outnet->now_tv, c->buffer);
-               } else {
-                       log_addr(VERB_ALGO, "response from upstream", &sq->addr, sq->addrlen);
-                       log_addr(VERB_ALGO, "to addr", &sq->outnet->ip4_ifs->addr, sq->outnet->ip4_ifs->addrlen);
-                       dt_msg_send_outside_response(outnet->dtenv, &sq->addr, &sq->outnet->ip4_ifs->addr, c->type,
-                         sq->zone, sq->zonelen, sq->qbuf, sq->qbuflen,
-                         &sq->last_sent_time, sq->outnet->now_tv, c->buffer);
-               }
+               log_addr(VERB_ALGO, "response from upstream", &sq->addr, sq->addrlen);
+               log_addr(VERB_ALGO, "to local addr", &pi->addr, pi->addrlen);
+               dt_msg_send_outside_response(outnet->dtenv, &sq->addr, &pi->addr, c->type,
+                 sq->zone, sq->zonelen, sq->qbuf, sq->qbuflen,
+                 &sq->last_sent_time, sq->outnet->now_tv, c->buffer);
        }
 #endif
        if( (sq->status == serviced_query_UDP_EDNS