diff options
author | jlemon <jlemon@FreeBSD.org> | 2003-03-08 22:07:52 +0000 |
---|---|---|
committer | jlemon <jlemon@FreeBSD.org> | 2003-03-08 22:07:52 +0000 |
commit | 673c0e4fca525cd035f1f68280e36d6c7793e248 (patch) | |
tree | ca6a6f6ab1410415b07117b31dce975ac538ef6a /sys/netinet/tcp_usrreq.c | |
parent | 03b8ace4891ef0ac6e1d27e79b9464022ed5fba0 (diff) | |
download | FreeBSD-src-673c0e4fca525cd035f1f68280e36d6c7793e248.zip FreeBSD-src-673c0e4fca525cd035f1f68280e36d6c7793e248.tar.gz |
Remove check for t_state == TCPS_TIME_WAIT and introduce the tw structure.
Sponsored by: DARPA, NAI Labs
Diffstat (limited to 'sys/netinet/tcp_usrreq.c')
-rw-r--r-- | sys/netinet/tcp_usrreq.c | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index a68345e..5212d6f 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -847,7 +847,7 @@ tcp_connect(tp, nam, td) { struct inpcb *inp = tp->t_inpcb, *oinp; struct socket *so = inp->inp_socket; - struct tcpcb *otp; + struct tcptw *otw; struct rmxp_tao *taop; struct rmxp_tao tao_noncached; struct in_addr laddr; @@ -872,13 +872,13 @@ tcp_connect(tp, nam, td) if (error && oinp == NULL) return error; if (oinp) { - if (oinp != inp && (otp = intotcpcb(oinp)) != NULL && - otp->t_state == TCPS_TIME_WAIT && - (ticks - otp->t_starttime) < tcp_msl && - (otp->t_flags & TF_RCVD_CC)) { + if (oinp != inp && + (oinp->inp_vflag & INP_TIMEWAIT) && + (ticks - (otw = intotw(oinp))->t_starttime) < tcp_msl && + otw->cc_recv != 0) { inp->inp_faddr = oinp->inp_faddr; inp->inp_fport = oinp->inp_fport; - otp = tcp_close(otp); + (void) tcp_twclose(otw, 0); } else return EADDRINUSE; } @@ -928,7 +928,7 @@ tcp6_connect(tp, nam, td) { struct inpcb *inp = tp->t_inpcb, *oinp; struct socket *so = inp->inp_socket; - struct tcpcb *otp; + struct tcptw *otw; struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam; struct in6_addr *addr6; struct rmxp_tao *taop; @@ -956,12 +956,14 @@ tcp6_connect(tp, nam, td) : &inp->in6p_laddr, inp->inp_lport, 0, NULL); if (oinp) { - if (oinp != inp && (otp = intotcpcb(oinp)) != NULL && - otp->t_state == TCPS_TIME_WAIT && - (ticks - otp->t_starttime) < tcp_msl && - (otp->t_flags & TF_RCVD_CC)) - otp = tcp_close(otp); - else + if (oinp != inp && + (oinp->inp_vflag & INP_TIMEWAIT) && + (ticks - (otw = intotw(oinp))->t_starttime) < tcp_msl && + otw->cc_recv != 0) { + inp->inp_faddr = oinp->inp_faddr; + inp->inp_fport = oinp->inp_fport; + (void) tcp_twclose(otw, 0); + } else return EADDRINUSE; } if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr)) |