]> git.ipfire.org Git - thirdparty/unbound.git/commitdiff
- Fix dnstap that assertion failed on logging other than UDP and TCP
authorW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 5 Dec 2023 12:14:08 +0000 (13:14 +0100)
committerW.C.A. Wijngaards <wouter@nlnetlabs.nl>
Tue, 5 Dec 2023 12:14:08 +0000 (13:14 +0100)
  traffic. It lists it as TCP traffic.

dnstap/dnstap.c
doc/Changelog

index d15eb9b004b20b11b8b021f71c38775d06a69d16..d9cdf7cead2d3684a1a2670a8e0685d543638d24 100644 (file)
@@ -371,7 +371,6 @@ dt_msg_fill_net(struct dt_msg *dm,
                 *has_rport = 1;
         }
 
-       log_assert(cptype == comm_udp || cptype == comm_tcp);
        if (cptype == comm_udp) {
                /* socket_protocol */
                dm->m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__UDP;
@@ -380,6 +379,10 @@ dt_msg_fill_net(struct dt_msg *dm,
                /* socket_protocol */
                dm->m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__TCP;
                dm->m.has_socket_protocol = 1;
+       } else {
+               /* other socket protocol */
+               dm->m.socket_protocol = DNSTAP__SOCKET_PROTOCOL__TCP;
+               dm->m.has_socket_protocol = 1;
        }
 }
 
@@ -410,7 +413,6 @@ dt_msg_send_client_query(struct dt_env *env,
        dt_fill_buffer(qmsg, &dm.m.query_message, &dm.m.has_query_message);
 
        /* socket_family, socket_protocol, query_address, query_port, response_address, response_port */
-       log_assert(cptype == comm_udp || cptype == comm_tcp);
        dt_msg_fill_net(&dm, qsock, rsock, cptype,
                        &dm.m.query_address, &dm.m.has_query_address,
                        &dm.m.query_port, &dm.m.has_query_port,
@@ -446,7 +448,6 @@ dt_msg_send_client_response(struct dt_env *env,
        dt_fill_buffer(rmsg, &dm.m.response_message, &dm.m.has_response_message);
 
        /* socket_family, socket_protocol, query_address, query_port, response_address, response_port */
-       log_assert(cptype == comm_udp || cptype == comm_tcp);
        dt_msg_fill_net(&dm, qsock, rsock, cptype,
                        &dm.m.query_address, &dm.m.has_query_address,
                        &dm.m.query_port, &dm.m.has_query_port,
@@ -497,7 +498,6 @@ dt_msg_send_outside_query(struct dt_env *env,
        dt_fill_buffer(qmsg, &dm.m.query_message, &dm.m.has_query_message);
 
        /* socket_family, socket_protocol, response_address, response_port, query_address, query_port */
-       log_assert(cptype == comm_udp || cptype == comm_tcp);
        dt_msg_fill_net(&dm, rsock, qsock, cptype,
                        &dm.m.response_address, &dm.m.has_response_address,
                        &dm.m.response_port, &dm.m.has_response_port,
@@ -556,7 +556,6 @@ dt_msg_send_outside_response(struct dt_env *env,
        dt_fill_buffer(rmsg, &dm.m.response_message, &dm.m.has_response_message);
 
        /* socket_family, socket_protocol, response_address, response_port, query_address, query_port */
-       log_assert(cptype == comm_udp || cptype == comm_tcp);
        dt_msg_fill_net(&dm, rsock, qsock, cptype,
                        &dm.m.response_address, &dm.m.has_response_address,
                        &dm.m.response_port, &dm.m.has_response_port,
index f42d1983739b28fef58eb88f2b69f166eb8db7b6..f6aa9ab6c4330c16aedee22e5c37eaf5aaf5987d 100644 (file)
@@ -1,6 +1,8 @@
 5 December 2023: Wouter
        - Merge #971: fix 'WARNING: Message has 41 extra bytes at end'.
        - Fix #969: [FR] distinguish Do53, DoT and DoH in the logs.
+       - Fix dnstap that assertion failed on logging other than UDP and TCP
+         traffic. It lists it as TCP traffic.
 
 27 November 2023: Yorgos
        - Merge #968: Replace the obsolescent fgrep with grep -F in tests.