]> git.ipfire.org Git - thirdparty/samba.git/commitdiff
ctdb-killtcp: Filter out sent packets
authorMartin Schwenke <martin@meltin.net>
Mon, 21 Mar 2016 00:11:19 +0000 (11:11 +1100)
committerAmitay Isaacs <amitay@samba.org>
Fri, 1 Apr 2016 02:42:12 +0000 (04:42 +0200)
When previously killing TCP connections via the daemon there was some
latency due to each kill being sent to the daemon via a separate
control.  This probably meant that when doing a 2-way kill the tickle
ACKs sent to the client end of a connection would not interfere with
listening for the reply ACK from the server end.  Now that there is no
latency, the tickle ACK or RST sent to the client end can be seen as
the reply to the server end tickle ACK, and vice-versa.

To avoid this, throw away packets that look like we sent them.

Signed-off-by: Martin Schwenke <martin@meltin.net>
Reviewed-by: Amitay Isaacs <amitay@gmail.com>
ctdb/tools/ctdb_killtcp.c

index f6b6a0e6ddec5229e00a641723b3abe379117b9c..11028cc954cacaa1b470d05156d68b352e847bf7 100644 (file)
@@ -124,6 +124,18 @@ static void capture_tcp_handler(struct tevent_context *ev,
                return;
        }
 
+       if (window == htons(1234) && (rst || seq == 0)) {
+               /* Ignore packets that we sent! */
+               DEBUG(DEBUG_DEBUG,
+                     ("Ignoring packet with dst=%s:%d, src=%s:%d, seq=%"PRIu32", ack_seq=%"PRIu32", rst=%d, window=%"PRIu16"\n",
+                      ctdb_sock_addr_to_string(killtcp, &dst),
+                      ntohs(dst.ip.sin_port),
+                      ctdb_sock_addr_to_string(killtcp, &src),
+                      ntohs(src.ip.sin_port),
+                      seq, ack_seq, rst, ntohs(window)));
+               return;
+       }
+
        /* check if we have this guy in our list of connections
           to kill
        */