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(a)gibson.dropbear.id.au> --- tcp.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/tcp.c b/tcp.c index edd3d899..47954d11 100644 --- a/tcp.c +++ b/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_LEN; *data++ = conn->ws_to_tap; - - th->ack = !!(flags & ACK); } else { - th->ack = !!(flags & ACK)) || - conn->seq_ack_to_tap != prev_ack_to_tap || - !prev_wnd_to_tap; + if (conn->seq_ack_to_tap != prev_ack_to_tap || + !prev_wnd_to_tap) + flags |= ACK; } th->doff = (sizeof(*th) + optlen) / 4; + th->ack = !!(flags & ACK); th->rst = !!(flags & RST); th->syn = !!(flags & SYN); th->fin = !!(flags & FIN); -- 2.44.0