From ad2be389414d64b79144d637a843d96757b90b26 Mon Sep 17 00:00:00 2001 From: Michael Tuexen Date: Thu, 22 Nov 2018 20:05:57 +0000 Subject: [PATCH] A TCP stack is required to check SEG.ACK first, when processing a segment in the SYN-SENT state as stated in Section 3.9 of RFC 793, page 66. Ensure this is also done by the TCP RACK stack. Reviewed by: rrs@ MFC after: 1 week Sponsored by: Netflix, Inc. Differential Revision: https://reviews.freebsd.org/D18034 --- sys/netinet/tcp_stacks/rack.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c index 13fced6fb0c1..d2db801b1f85 100644 --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -6532,6 +6532,15 @@ rack_hpts_do_segment(struct mbuf *m, struct tcphdr *th, struct socket *so, way_out = 4; goto done_with_input; } + /* + * If a segment with the ACK-bit set arrives in the SYN-SENT state + * check SEQ.ACK first as described on page 66 of RFC 793, section 3.9. + */ + if ((tp->t_state == TCPS_SYN_SENT) && (thflags & TH_ACK) && + (SEQ_LEQ(th->th_ack, tp->iss) || SEQ_GT(th->th_ack, tp->snd_max))) { + rack_do_dropwithreset(m, tp, th, BANDLIM_RST_OPENPORT, tlen); + return; + } /* * Segment received on connection. Reset idle time and keep-alive * timer. XXX: This should be done after segment validation to