tcp: Never automatically add the ACK flag to RST packets
tcp_send_flag() will sometimes force on the ACK flag for all !SYN packets. This doesn't make sense for RST packets, where plain RST and RST+ACK have somewhat different meanings. AIUI, RST+ACK indicates an abrupt end to a connection, but acknowledges data already sent. Plain RST indicates an abort, when one end receives a packet that doesn't seem to make sense in the context of what it knows about the connection. All of the cases where we send RSTs are the second, so we don't want an ACK flag, but we currently could add one anyway. Change that, so we won't add an ACK to an RST unless the caller explicitly requests it. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
16c2d8da0d
commit
5894a245b9
1 changed files with 1 additions and 1 deletions
2
tcp.c
2
tcp.c
|
@ -1674,7 +1674,7 @@ static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
|
||||||
*data++ = OPT_WS;
|
*data++ = OPT_WS;
|
||||||
*data++ = OPT_WS_LEN;
|
*data++ = OPT_WS_LEN;
|
||||||
*data++ = conn->ws_to_tap;
|
*data++ = conn->ws_to_tap;
|
||||||
} else {
|
} else if (!(flags & RST)) {
|
||||||
if (conn->seq_ack_to_tap != prev_ack_to_tap ||
|
if (conn->seq_ack_to_tap != prev_ack_to_tap ||
|
||||||
!prev_wnd_to_tap)
|
!prev_wnd_to_tap)
|
||||||
flags |= ACK;
|
flags |= ACK;
|
||||||
|
|
Loading…
Reference in a new issue