diff options
author | Markus Friedl <markus@cvs.openbsd.org> | 2003-12-08 10:48:58 +0000 |
---|---|---|
committer | Markus Friedl <markus@cvs.openbsd.org> | 2003-12-08 10:48:58 +0000 |
commit | 46ede81659e700216bc1f4873fb0f610c8358859 (patch) | |
tree | b4341792a0cadc2e9a738c347c6d9451d81d2eab | |
parent | 28045fe02f89a8af2ecfe366c49adaa949ae55f3 (diff) |
switch to CIRCLEQ_FOREACH_REVERSE in tcpdropoldhalfopen() and
avoid dropping youngest TCB; ok henning deraadt
-rw-r--r-- | sys/netinet/tcp_input.c | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/sys/netinet/tcp_input.c b/sys/netinet/tcp_input.c index 945076d1f62..8df35d0d1be 100644 --- a/sys/netinet/tcp_input.c +++ b/sys/netinet/tcp_input.c @@ -1,4 +1,4 @@ -/* $OpenBSD: tcp_input.c,v 1.135 2003/12/08 07:07:36 mcbride Exp $ */ +/* $OpenBSD: tcp_input.c,v 1.136 2003/12/08 10:48:57 markus Exp $ */ /* $NetBSD: tcp_input.c,v 1.23 1996/02/13 23:43:44 christos Exp $ */ /* @@ -323,10 +323,7 @@ tcpdropoldhalfopen(avoidtp, port) int s; s = splnet(); - inp = tcbtable.inpt_queue.cqh_first; - if (inp) /* XXX */ - for (; inp != (struct inpcb *)&tcbtable.inpt_queue && --ncheck; - inp = inp->inp_queue.cqe_prev) { + CIRCLEQ_FOREACH_REVERSE(inp, &tcbtable.inpt_queue, inp_queue) { if ((tp = (struct tcpcb *)inp->inp_ppcb) && tp != avoidtp && tp->t_state == TCPS_SYN_RECEIVED && @@ -334,12 +331,11 @@ tcpdropoldhalfopen(avoidtp, port) tcp_close(tp); goto done; } + if (--ncheck) + break; } - inp = tcbtable.inpt_queue.cqh_first; - if (inp) /* XXX */ - for (; inp != (struct inpcb *)&tcbtable.inpt_queue; - inp = inp->inp_queue.cqe_prev) { + CIRCLEQ_FOREACH_REVERSE(inp, &tcbtable.inpt_queue, inp_queue) { if ((tp = (struct tcpcb *)inp->inp_ppcb) && tp != avoidtp && tp->t_state == TCPS_SYN_RECEIVED) { |