diff options
author | Niels Provos <provos@cvs.openbsd.org> | 1999-08-27 15:35:57 +0000 |
---|---|---|
committer | Niels Provos <provos@cvs.openbsd.org> | 1999-08-27 15:35:57 +0000 |
commit | 4b4af6c2afcfefe239fa24d3a00cc34af9867905 (patch) | |
tree | f4f9c0d64f1dcc70dd0a92b8827986164b435898 | |
parent | e3a76b41d24b445123eacf30206e42df66f8983d (diff) |
more SACK hole validity testing; fix a tcp seq arithmetic bug. cmetz and me.
-rw-r--r-- | sys/netinet/tcp_input.c | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 6de998b4a40..36fda0deedc 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.46 1999/08/06 18:17:37 deraadt Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.47 1999/08/27 15:35:56 provos Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -2253,6 +2253,15 @@ tcp_sack_option(tp, th, cp, optlen) if (SEQ_GEQ(sack.end, tp->snd_fack)) tp->snd_fack = sack.end; #endif /* TCP_FACK */ + if (SEQ_GT(th->th_ack, tp->snd_una)) { + if (SEQ_LT(sack.start, th->th_ack)) + continue; + } else { + if (SEQ_LT(sack.start, tp->snd_una)) + continue; + } + if (SEQ_GEQ(sack.end, tp->snd_max)) + continue; if (tp->snd_holes == 0) { /* first hole */ tp->snd_holes = (struct sackhole *) malloc(sizeof(struct sackhole), M_PCB, M_NOWAIT); @@ -2435,7 +2444,8 @@ tcp_del_sackholes(tp, th) { if (!tp->sack_disable && tp->t_state != TCPS_LISTEN) { /* max because this could be an older ack just arrived */ - tcp_seq lastack = max(th->th_ack, tp->snd_una); + tcp_seq lastack = SEQ_GT(th->th_ack, tp->snd_una) ? + th->th_ack : tp->snd_una; struct sackhole *cur = tp->snd_holes; struct sackhole *prev = cur; while (cur) |