ctdb-tools: Improve/add debug
authorMartin Schwenke <martin@meltin.net>
Sun, 14 Aug 2022 23:41:09 +0000 (09:41 +1000)
committerJule Anger <janger@samba.org>
Tue, 29 Aug 2023 09:35:11 +0000 (09:35 +0000)
In particular, knowing the reason fetching the packet fails can help
with debugging unsupported protocols in the pcap code.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
(cherry picked from commit 5dd964aa0297b6e9ab8e1d0ff9fa0565c97ea43e)

ctdb/tools/ctdb_killtcp.c

index bab81092058a666e2d5817347b0aa2d80e38f501..007422f42fc908a9386a406afcacca1ce6e647be 100644 (file)
@@ -169,17 +169,18 @@ static void reset_connections_capture_tcp_handler(struct tevent_context *ev,
                                       &conn.server, &conn.client,
                                       &ack_seq, &seq, &rst, &window);
        if (ret != 0) {
-               /* probably a non-tcp ACK packet */
+               /* Not a TCP-ACK?  Unexpected protocol? */
+               DBG_DEBUG("Failed to parse packet, errno=%d\n", ret);
                return;
        }
 
        if (window == htons(1234) && (rst || seq == 0)) {
                /* Ignore packets that we sent! */
-               D_DEBUG("Ignoring packet: %s, "
-                       "seq=%"PRIu32", ack_seq=%"PRIu32", "
-                       "rst=%d, window=%"PRIu16"\n",
-                       ctdb_connection_to_string(state, &conn, false),
-                       seq, ack_seq, rst, ntohs(window));
+               DBG_DEBUG("Ignoring sent packet: %s, "
+                         "seq=%"PRIu32", ack_seq=%"PRIu32", "
+                         "rst=%d, window=%"PRIu16"\n",
+                         ctdb_connection_to_string(state, &conn, false),
+                         seq, ack_seq, rst, ntohs(window));
                return;
        }