Skip to content

Commit

Permalink
ctdb-killtcp: Filter out sent packets
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Amitay Isaacs <[email protected]>
  • Loading branch information
martin-schwenke authored and Amitay Isaacs committed Apr 1, 2016
1 parent bba3115 commit 7e5eab1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions ctdb/tools/ctdb_killtcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down

0 comments on commit 7e5eab1

Please sign in to comment.