svn commit: r339989 - head/sys/netinet
Michael Tuexen
tuexen at FreeBSD.org
Thu Nov 1 11:35:29 UTC 2018
Author: tuexen
Date: Thu Nov 1 11:35:28 2018
New Revision: 339989
URL: https://svnweb.freebsd.org/changeset/base/339989
Log:
Improve a comment to refer to the actual sections in the TCP
specification for the comparisons made.
Thanks to lstewart@ for the suggestion.
MFC after: 4 weeks
Sponsored by: Netflix, Inc.
Differential Revision: https://reviews.freebsd.org/D17595
Modified:
head/sys/netinet/tcp_syncache.c
Modified: head/sys/netinet/tcp_syncache.c
==============================================================================
--- head/sys/netinet/tcp_syncache.c Thu Nov 1 10:25:22 2018 (r339988)
+++ head/sys/netinet/tcp_syncache.c Thu Nov 1 11:35:28 2018 (r339989)
@@ -581,15 +581,28 @@ syncache_chkrst(struct in_conninfo *inc, struct tcphdr
/*
* If the RST bit is set, check the sequence number to see
* if this is a valid reset segment.
+ *
* RFC 793 page 37:
* In all states except SYN-SENT, all reset (RST) segments
* are validated by checking their SEQ-fields. A reset is
* valid if its sequence number is in the window.
*
- * The sequence number in the reset segment is normally an
- * echo of our outgoing acknowlegement numbers, but some hosts
- * send a reset with the sequence number at the rightmost edge
- * of our receive window, and we have to handle this case.
+ * RFC 793 page 69:
+ * There are four cases for the acceptability test for an incoming
+ * segment:
+ *
+ * Segment Receive Test
+ * Length Window
+ * ------- ------- -------------------------------------------
+ * 0 0 SEG.SEQ = RCV.NXT
+ * 0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
+ * >0 0 not acceptable
+ * >0 >0 RCV.NXT =< SEG.SEQ < RCV.NXT+RCV.WND
+ * or RCV.NXT =< SEG.SEQ+SEG.LEN-1 < RCV.NXT+RCV.WND
+ *
+ * Note that when receiving a SYN segment in the LISTEN state,
+ * IRS is set to SEG.SEQ and RCV.NXT is set to SEG.SEQ+1, as
+ * described in RFC 793, page 66.
*/
if ((SEQ_GEQ(th->th_seq, sc->sc_irs + 1) &&
SEQ_LT(th->th_seq, sc->sc_irs + 1 + sc->sc_wnd)) ||
@@ -1731,6 +1744,7 @@ syncache_respond(struct syncache *sc, struct syncache_
th->th_seq = htonl(sc->sc_iss);
else
th->th_seq = htonl(sc->sc_iss + 1);
+printf("SEG.SEQ=0x%x, ISS=0x%x.\n", ntohl(th->th_seq), sc->sc_iss);
th->th_ack = htonl(sc->sc_irs + 1);
th->th_off = sizeof(struct tcphdr) >> 2;
th->th_x2 = 0;
More information about the svn-src-all
mailing list