tcp: add ACK flag to RST packet 45/32945/2
authorliuyacan <liuyacan@corp.netease.com>
Tue, 29 Jun 2021 08:45:11 +0000 (16:45 +0800)
committerFlorin Coras <florin.coras@gmail.com>
Tue, 29 Jun 2021 15:32:49 +0000 (15:32 +0000)
According to RFC 793, the ACK control bit is always sent once
the connection is established.

Type: fix

Signed-off-by: liuyacan <liuyacan@corp.netease.com>
Change-Id: Id0fe19114a0cc468dbce4c0938b345c2ac339e73

src/vnet/tcp/tcp_output.c

index 0ba349c..5690db0 100644 (file)
@@ -766,7 +766,7 @@ tcp_send_reset (tcp_connection_t * tc)
   tc->snd_opts_len = tcp_make_options (tc, &tc->snd_opts, tc->state);
   tcp_hdr_opts_len = tc->snd_opts_len + sizeof (tcp_header_t);
   advertise_wnd = tc->rcv_wnd >> tc->rcv_wscale;
-  flags = TCP_FLAG_RST;
+  flags = TCP_FLAG_RST | TCP_FLAG_ACK;
   th = vlib_buffer_push_tcp (b, tc->c_lcl_port, tc->c_rmt_port, tc->snd_nxt,
                             tc->rcv_nxt, tcp_hdr_opts_len, flags,
                             advertise_wnd);