tcp: Rearrange logic for setting ACK flag in tcp_send_flag()
We have different paths for controlling the ACK flag for the SYN and !SYN paths. This amounts to sometimes forcing on the ACK flag in the !SYN path regardless of options. We can rearrange things to explicitly be that which will make things neater for some future changes. Signed-off-by: David Gibson <david@gibson.dropbear.id.au> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
This commit is contained in:
parent
99355e25b9
commit
16c2d8da0d
1 changed files with 4 additions and 5 deletions
9
tcp.c
9
tcp.c
|
@ -1674,16 +1674,15 @@ 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;
|
||||||
|
|
||||||
th->ack = !!(flags & ACK);
|
|
||||||
} else {
|
} else {
|
||||||
th->ack = !!(flags & ACK)) ||
|
if (conn->seq_ack_to_tap != prev_ack_to_tap ||
|
||||||
conn->seq_ack_to_tap != prev_ack_to_tap ||
|
!prev_wnd_to_tap)
|
||||||
!prev_wnd_to_tap;
|
flags |= ACK;
|
||||||
}
|
}
|
||||||
|
|
||||||
th->doff = (sizeof(*th) + optlen) / 4;
|
th->doff = (sizeof(*th) + optlen) / 4;
|
||||||
|
|
||||||
|
th->ack = !!(flags & ACK);
|
||||||
th->rst = !!(flags & RST);
|
th->rst = !!(flags & RST);
|
||||||
th->syn = !!(flags & SYN);
|
th->syn = !!(flags & SYN);
|
||||||
th->fin = !!(flags & FIN);
|
th->fin = !!(flags & FIN);
|
||||||
|
|
Loading…
Reference in a new issue