Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F165143940
D58594.id183256.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
2 KB
Referenced Files
None
Subscribers
None
D58594.id183256.diff
View Options
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c
--- a/sys/netinet/tcp_input.c
+++ b/sys/netinet/tcp_input.c
@@ -2125,20 +2125,26 @@
* - RST drops connection only if SEG.SEQ == RCV.NXT.
* - If RST is in window, we send challenge ACK.
*
- * Note: to take into account delayed ACKs, we should
- * test against last_ack_sent instead of rcv_nxt.
+ * Note 1: to take into account delayed ACKs, we should
+ * test against last_ack_sent in addition to rcv_nxt.
* Note 2: we handle special case of closed window, not
* covered by the RFC.
+ * Note 3 (XXXMT): check against rcv_adv instead of
+ * tp->rcv_nxt + tp->rcv_wnd.
*/
- if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
- SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) ||
- (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) {
+ if ((tp->rcv_wnd > 0 &&
+ SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
+ SEQ_LT(th->th_seq, tp->rcv_nxt + tp->rcv_wnd)) ||
+ (tp->rcv_wnd == 0 &&
+ (tp->last_ack_sent == th->th_seq ||
+ tp->rcv_nxt == th->th_seq))) {
KASSERT(tp->t_state != TCPS_SYN_SENT,
("%s: TH_RST for TCPS_SYN_SENT th %p tp %p",
__func__, th, tp));
if (V_tcp_insecure_rst ||
- tp->last_ack_sent == th->th_seq) {
+ tp->last_ack_sent == th->th_seq ||
+ tp->rcv_nxt == th->th_seq) {
TCPSTAT_INC(tcps_drops);
/* Drop the connection. */
switch (tp->t_state) {
diff --git a/sys/netinet/tcp_stacks/rack_bbr_common.c b/sys/netinet/tcp_stacks/rack_bbr_common.c
--- a/sys/netinet/tcp_stacks/rack_bbr_common.c
+++ b/sys/netinet/tcp_stacks/rack_bbr_common.c
@@ -697,18 +697,24 @@
/*
* RFC5961 Section 3.2
*
- * - RST drops connection only if SEG.SEQ == RCV.NXT. - If RST is in
- * window, we send challenge ACK.
+ * - RST drops connection only if SEG.SEQ == RCV.NXT.
+ * - If RST is in window, we send challenge ACK.
*
- * Note: to take into account delayed ACKs, we should test against
- * last_ack_sent instead of rcv_nxt. Note 2: we handle special case
- * of closed window, not covered by the RFC.
+ * Note 1: to take into account delayed ACKs, we should
+ * test against last_ack_sent in addition to rcv_nxt.
+ * Note 2: we handle special case of closed window, not
+ * covered by the RFC.
+ * Note 3 (XXXMT): check against rcv_adv instead of
+ * tp->rcv_nxt + tp->rcv_wnd.
*/
int dropped = 0;
- if ((SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
- SEQ_LT(th->th_seq, tp->last_ack_sent + tp->rcv_wnd)) ||
- (tp->rcv_wnd == 0 && tp->last_ack_sent == th->th_seq)) {
+ if ((tp->rcv_wnd > 0 &&
+ SEQ_GEQ(th->th_seq, tp->last_ack_sent) &&
+ SEQ_LT(th->th_seq, tp->rcv_nxt + tp->rcv_wnd)) ||
+ (tp->rcv_wnd == 0 &&
+ (tp->last_ack_sent == th->th_seq ||
+ tp->rcv_nxt == th->th_seq))) {
KASSERT(tp->t_state != TCPS_SYN_SENT,
("%s: TH_RST for TCPS_SYN_SENT th %p tp %p",
__func__, th, tp));
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Aug 7, 9:27 AM (11 h, 40 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
36061718
Default Alt Text
D58594.id183256.diff (2 KB)
Attached To
Mode
D58594: tcp: improve SEG.SEQ validation for RST segments
Attached
Detach File
Event Timeline
Log In to Comment