1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-12-14 10:09:48 +00:00

According to RFC 793, a reset should be honored if the sequence number

is within the receive window.  Follow this behavior, instead of only
allowing resets at last_ack_sent.

Pointed out by:	jayanth@yahoo-inc.com
This commit is contained in:
Jonathan Lemon 1999-12-11 04:05:52 +00:00
parent f1b5e7b750
commit 1a244a616d
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=54421
2 changed files with 12 additions and 14 deletions

View File

@ -1092,12 +1092,10 @@ tcp_input(m, iphlen)
* valid if its sequence number is in the window. * valid if its sequence number is in the window.
* Note: this does not take into account delayed ACKs, so * Note: this does not take into account delayed ACKs, so
* we should test against last_ack_sent instead of rcv_nxt. * we should test against last_ack_sent instead of rcv_nxt.
* Also, it does not make sense to allow reset segments with * The sequence number in the reset segment is normally an
* sequence numbers greater than last_ack_sent to be processed * echo of our outgoing acknowlegement numbers, but some hosts
* since these sequence numbers are just the acknowledgement * send a reset with the sequence number at the rightmost edge
* numbers in our outgoing packets being echoed back at us, * of our receive window, and we have to handle this case.
* and these acknowledgement numbers are monotonically
* increasing.
* If we have multiple segments in flight, the intial reset * If we have multiple segments in flight, the intial reset
* segment sequence numbers will be to the left of last_ack_sent, * segment sequence numbers will be to the left of last_ack_sent,
* but they will eventually catch up. * but they will eventually catch up.
@ -1127,7 +1125,8 @@ tcp_input(m, iphlen)
* RFC 1337. * RFC 1337.
*/ */
if (tiflags & TH_RST) { if (tiflags & TH_RST) {
if (tp->last_ack_sent == ti->ti_seq) { if (ti->ti_seq >= tp->last_ack_sent &&
ti->ti_seq < tp->last_ack_sent + tp->rcv_wnd) {
switch (tp->t_state) { switch (tp->t_state) {
case TCPS_SYN_RECEIVED: case TCPS_SYN_RECEIVED:

View File

@ -1092,12 +1092,10 @@ tcp_input(m, iphlen)
* valid if its sequence number is in the window. * valid if its sequence number is in the window.
* Note: this does not take into account delayed ACKs, so * Note: this does not take into account delayed ACKs, so
* we should test against last_ack_sent instead of rcv_nxt. * we should test against last_ack_sent instead of rcv_nxt.
* Also, it does not make sense to allow reset segments with * The sequence number in the reset segment is normally an
* sequence numbers greater than last_ack_sent to be processed * echo of our outgoing acknowlegement numbers, but some hosts
* since these sequence numbers are just the acknowledgement * send a reset with the sequence number at the rightmost edge
* numbers in our outgoing packets being echoed back at us, * of our receive window, and we have to handle this case.
* and these acknowledgement numbers are monotonically
* increasing.
* If we have multiple segments in flight, the intial reset * If we have multiple segments in flight, the intial reset
* segment sequence numbers will be to the left of last_ack_sent, * segment sequence numbers will be to the left of last_ack_sent,
* but they will eventually catch up. * but they will eventually catch up.
@ -1127,7 +1125,8 @@ tcp_input(m, iphlen)
* RFC 1337. * RFC 1337.
*/ */
if (tiflags & TH_RST) { if (tiflags & TH_RST) {
if (tp->last_ack_sent == ti->ti_seq) { if (ti->ti_seq >= tp->last_ack_sent &&
ti->ti_seq < tp->last_ack_sent + tp->rcv_wnd) {
switch (tp->t_state) { switch (tp->t_state) {
case TCPS_SYN_RECEIVED: case TCPS_SYN_RECEIVED: