tcp: Split handling of DUP_ACK from ACK
The DUP_ACK flag to tcp_send_flag() has two effects: first it forces the setting of the ACK flag in the packet, even if we otherwise wouldn't. Secondly, it causes a duplicate of the flags packet to be sent immediately after the first. Setting the ACK flag to tcp_send_flag() also has the first effect, so instead of having DUP_ACK also do that, pass both flags when we need both operations. This slightly simplifies the logic of tcp_send_flag() in a way that makes some future changes easier. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
71dd405460
commit
99355e25b9
1 changed files with 2 additions and 2 deletions
4
tcp.c
4
tcp.c
|
@ -1677,7 +1677,7 @@ static int tcp_send_flag(struct ctx *c, struct tcp_tap_conn *conn, int flags)
|
|||
|
||||
th->ack = !!(flags & ACK);
|
||||
} else {
|
||||
th->ack = !!(flags & (ACK | DUP_ACK)) ||
|
||||
th->ack = !!(flags & ACK)) ||
|
||||
conn->seq_ack_to_tap != prev_ack_to_tap ||
|
||||
!prev_wnd_to_tap;
|
||||
}
|
||||
|
@ -2503,7 +2503,7 @@ out:
|
|||
*/
|
||||
if (conn->seq_dup_ack_approx != (conn->seq_from_tap & 0xff)) {
|
||||
conn->seq_dup_ack_approx = conn->seq_from_tap & 0xff;
|
||||
tcp_send_flag(c, conn, DUP_ACK);
|
||||
tcp_send_flag(c, conn, ACK | DUP_ACK);
|
||||
}
|
||||
return p->count - idx;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue