diff --git a/sys/dev/cxgbe/crypto/t6_kern_tls.c b/sys/dev/cxgbe/crypto/t6_kern_tls.c --- a/sys/dev/cxgbe/crypto/t6_kern_tls.c +++ b/sys/dev/cxgbe/crypto/t6_kern_tls.c @@ -462,7 +462,7 @@ inp = params->tls.inp; INP_RLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_RUNLOCK(inp); error = ECONNRESET; goto failed; @@ -504,7 +504,7 @@ goto failed; } - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_RUNLOCK(inp); error = ECONNRESET; goto failed; diff --git a/sys/dev/cxgbe/cxgbei/cxgbei.c b/sys/dev/cxgbe/cxgbei/cxgbei.c --- a/sys/dev/cxgbe/cxgbei/cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/cxgbei.c @@ -517,7 +517,7 @@ } INP_WLOCK(inp); - if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { + if (__predict_false(inp->inp_flags & INP_DROPPED)) { CTR4(KTR_CXGBE, "%s: tid %u, rx (%d bytes), inp_flags 0x%x", __func__, tid, pdu_len, inp->inp_flags); INP_WUNLOCK(inp); @@ -670,7 +670,7 @@ } INP_WLOCK(inp); - if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { + if (__predict_false(inp->inp_flags & INP_DROPPED)) { CTR4(KTR_CXGBE, "%s: tid %u, rx (%d bytes), inp_flags 0x%x", __func__, tid, pdu_len, inp->inp_flags); INP_WUNLOCK(inp); diff --git a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c --- a/sys/dev/cxgbe/cxgbei/icl_cxgbei.c +++ b/sys/dev/cxgbe/cxgbei/icl_cxgbei.c @@ -478,8 +478,7 @@ INP_WLOCK(inp); ICL_CONN_UNLOCK(ic); - if (__predict_false(inp->inp_flags & (INP_DROPPED | - INP_TIMEWAIT)) || + if (__predict_false(inp->inp_flags & INP_DROPPED) || __predict_false((toep->flags & TPF_ATTACHED) == 0)) { mbufq_drain(&mq); } else { @@ -1007,7 +1006,7 @@ inp = sotoinpcb(so); INP_WLOCK(inp); - if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) == 0) { + if ((inp->inp_flags & INP_DROPPED) == 0) { tp = intotcpcb(inp); if (tp->t_flags & TF_TOE && tp->tod == &td->tod) fa->sc = sc; /* Found. */ @@ -1164,7 +1163,7 @@ inp = sotoinpcb(so); INP_WLOCK(inp); tp = intotcpcb(inp); - if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); error = ENOTCONN; goto out; @@ -1506,7 +1505,7 @@ */ inp = sotoinpcb(ic->ic_socket); INP_WLOCK(inp); - if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { + if ((inp->inp_flags & INP_DROPPED) != 0) { INP_WUNLOCK(inp); mbufq_drain(&mq); t4_free_page_pods(prsv); @@ -1683,7 +1682,7 @@ inp = sotoinpcb(ic->ic_socket); INP_WLOCK(inp); ICL_CONN_UNLOCK(ic); - if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { + if ((inp->inp_flags & INP_DROPPED) != 0) { INP_WUNLOCK(inp); mbufq_drain(&mq); t4_free_page_pods(prsv); diff --git a/sys/dev/cxgbe/iw_cxgbe/qp.c b/sys/dev/cxgbe/iw_cxgbe/qp.c --- a/sys/dev/cxgbe/iw_cxgbe/qp.c +++ b/sys/dev/cxgbe/iw_cxgbe/qp.c @@ -1316,7 +1316,7 @@ CTR3(KTR_IW_CXGBE, "%s:creB %p %u", __func__, toep , wrsize); INP_WLOCK(inp); - if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) != 0) { + if ((inp->inp_flags & INP_DROPPED) != 0) { INP_WUNLOCK(inp); return (EINVAL); } diff --git a/sys/dev/cxgbe/tom/t4_cpl_io.c b/sys/dev/cxgbe/tom/t4_cpl_io.c --- a/sys/dev/cxgbe/tom/t4_cpl_io.c +++ b/sys/dev/cxgbe/tom/t4_cpl_io.c @@ -288,7 +288,7 @@ * XXX: What's the correct way to tell that the inp hasn't been detached * from its socket? Should I even be flushing the snd buffer here? */ - if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) == 0) { + if ((inp->inp_flags & INP_DROPPED) == 0) { struct socket *so = inp->inp_socket; if (so != NULL) /* because I'm not sure. See comment above */ @@ -1611,7 +1611,7 @@ } toep->flags |= TPF_ABORT_SHUTDOWN; - if ((inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) == 0) { + if ((inp->inp_flags & INP_DROPPED) == 0) { struct socket *so = inp->inp_socket; if (so != NULL) @@ -1701,7 +1701,7 @@ len = m->m_pkthdr.len; INP_WLOCK(inp); - if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) { + if (inp->inp_flags & INP_DROPPED) { CTR4(KTR_CXGBE, "%s: tid %u, rx (%d bytes), inp_flags 0x%x", __func__, tid, len, inp->inp_flags); INP_WUNLOCK(inp); @@ -1874,7 +1874,7 @@ return (0); } - KASSERT((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0, + KASSERT((inp->inp_flags & INP_DROPPED) == 0, ("%s: inp_flags 0x%x", __func__, inp->inp_flags)); tp = intotcpcb(inp); @@ -2290,7 +2290,7 @@ inp = toep->inp; INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); SOCK_IO_SEND_UNLOCK(so); error = ECONNRESET; diff --git a/sys/dev/cxgbe/tom/t4_ddp.c b/sys/dev/cxgbe/tom/t4_ddp.c --- a/sys/dev/cxgbe/tom/t4_ddp.c +++ b/sys/dev/cxgbe/tom/t4_ddp.c @@ -504,7 +504,7 @@ db = &toep->ddp.db[db_idx]; job = db->job; - if (__predict_false(inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { + if (__predict_false(inp->inp_flags & INP_DROPPED)) { /* * This can happen due to an administrative tcpdrop(8). * Just fail the request with ECONNRESET. diff --git a/sys/dev/cxgbe/tom/t4_tls.c b/sys/dev/cxgbe/tom/t4_tls.c --- a/sys/dev/cxgbe/tom/t4_tls.c +++ b/sys/dev/cxgbe/tom/t4_tls.c @@ -894,7 +894,7 @@ ("%s: payload length mismatch", __func__)); INP_WLOCK(inp); - if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) { + if (inp->inp_flags & INP_DROPPED) { CTR4(KTR_CXGBE, "%s: tid %u, rx (%d bytes), inp_flags 0x%x", __func__, tid, len, inp->inp_flags); INP_WUNLOCK(inp); @@ -964,7 +964,7 @@ ("%s: payload length mismatch", __func__)); INP_WLOCK(inp); - if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) { + if (inp->inp_flags & INP_DROPPED) { CTR4(KTR_CXGBE, "%s: tid %u, rx (%d bytes), inp_flags 0x%x", __func__, tid, len, inp->inp_flags); INP_WUNLOCK(inp); diff --git a/sys/kern/uipc_ktls.c b/sys/kern/uipc_ktls.c --- a/sys/kern/uipc_ktls.c +++ b/sys/kern/uipc_ktls.c @@ -865,7 +865,7 @@ inp = so->so_pcb; INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -916,7 +916,7 @@ int error; INP_RLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_RUNLOCK(inp); return (ECONNRESET); } @@ -1016,7 +1016,7 @@ return (ENXIO); INP_RLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_RUNLOCK(inp); return (ECONNRESET); } @@ -1463,7 +1463,7 @@ INP_RUNLOCK(inp); return (EINVAL); } - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_RUNLOCK(inp); return (ECONNRESET); } @@ -1625,7 +1625,7 @@ ifp = NULL; INP_RLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_RUNLOCK(inp); goto out; } @@ -1746,8 +1746,7 @@ NET_EPOCH_ENTER(et); INP_WLOCK(inp); if (!in_pcbrele_wlocked(inp)) { - if (!(inp->inp_flags & INP_TIMEWAIT) && - !(inp->inp_flags & INP_DROPPED)) { + if (!(inp->inp_flags & INP_DROPPED)) { tp = intotcpcb(inp); CURVNET_SET(tp->t_vnet); tp = tcp_drop(tp, ECONNABORTED); @@ -2288,7 +2287,7 @@ return (EINVAL); INP_RLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_RUNLOCK(inp); return (ECONNRESET); } @@ -3178,7 +3177,7 @@ INP_WLOCK(inp); so = inp->inp_socket; MPASS(so != NULL); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { goto out; } @@ -3189,7 +3188,7 @@ if (err == 0) { counter_u64_add(ktls_ifnet_disable_ok, 1); /* ktls_set_tx_mode() drops inp wlock, so recheck flags */ - if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0 && + if ((inp->inp_flags & INP_DROPPED) == 0 && (tp = intotcpcb(inp)) != NULL && tp->t_fb->tfb_hwtls_change != NULL) (*tp->t_fb->tfb_hwtls_change)(tp, 0); diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -205,9 +205,8 @@ * to a field, a write lock must generally be held. * * netinet/netinet6-layer code should not assume that the inp_socket pointer - * is safe to dereference without inp_lock being held, even for protocols - * other than TCP (where the inpcb persists during TIMEWAIT even after the - * socket has been freed), or there may be close(2)-related races. + * is safe to dereference without inp_lock being held, there may be + * close(2)-related races. * * The inp_vflag field is overloaded, and would otherwise ideally be (c). */ @@ -641,7 +640,7 @@ #define IN6P_RTHDRDSTOPTS 0x00200000 /* receive dstoptions before rthdr */ #define IN6P_TCLASS 0x00400000 /* receive traffic class value */ #define IN6P_AUTOFLOWLABEL 0x00800000 /* attach flowlabel automatically */ -#define INP_TIMEWAIT 0x01000000 /* in TIMEWAIT, ppcb is tcptw */ +/* was INP_TIMEWAIT 0x01000000 */ #define INP_ONESBCAST 0x02000000 /* send all-ones broadcast */ #define INP_DROPPED 0x04000000 /* protocol drop flag */ #define INP_SOCKREF 0x08000000 /* strong socket reference */ diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1047,7 +1047,6 @@ */ if (t && ((inp->inp_flags2 & INP_BINDMULTI) == 0) && - ((t->inp_flags & INP_TIMEWAIT) == 0) && (so->so_type != SOCK_STREAM || ntohl(t->inp_faddr.s_addr) == INADDR_ANY) && (ntohl(sin->sin_addr.s_addr) != INADDR_ANY || @@ -2865,7 +2864,7 @@ } while ((inp = inp_next(&inpi)) != NULL) if (inp->inp_gencnt == params->sop_id) { - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -3015,10 +3014,6 @@ db_printf("%sIN6P_AUTOFLOWLABEL", comma ? ", " : ""); comma = 1; } - if (inp_flags & INP_TIMEWAIT) { - db_printf("%sINP_TIMEWAIT", comma ? ", " : ""); - comma = 1; - } if (inp_flags & INP_ONESBCAST) { db_printf("%sINP_ONESBCAST", comma ? ", " : ""); comma = 1; @@ -3234,7 +3229,7 @@ * down, allocating a new send tag is not allowed. Else send * tags may leak. */ - if (*st != NULL || (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) != 0) + if (*st != NULL || (inp->inp_flags & INP_DROPPED) != 0) return (EINVAL); error = m_snd_tag_alloc(ifp, ¶ms, st); diff --git a/sys/netinet/siftr.c b/sys/netinet/siftr.c --- a/sys/netinet/siftr.c +++ b/sys/netinet/siftr.c @@ -896,10 +896,9 @@ /* * If we can't find the TCP control block (happens occasionaly for a - * packet sent during the shutdown phase of a TCP connection), - * or we're in the timewait state, bail + * packet sent during the shutdown phase of a TCP connection), bail */ - if (tp == NULL || inp->inp_flags & INP_TIMEWAIT) { + if (tp == NULL) { if (dir == PFIL_IN) ss->nskip_in_tcpcb++; else @@ -1081,10 +1080,9 @@ /* * If we can't find the TCP control block (happens occasionaly for a - * packet sent during the shutdown phase of a TCP connection), - * or we're in the timewait state, bail. + * packet sent during the shutdown phase of a TCP connection), bail */ - if (tp == NULL || inp->inp_flags & INP_TIMEWAIT) { + if (tp == NULL) { if (dir == PFIL_IN) ss->nskip_in_tcpcb++; else diff --git a/sys/netinet/tcp_hpts.c b/sys/netinet/tcp_hpts.c --- a/sys/netinet/tcp_hpts.c +++ b/sys/netinet/tcp_hpts.c @@ -501,7 +501,7 @@ INP_WLOCK_ASSERT(inp); HPTS_MTX_ASSERT(hpts); MPASS(hpts->p_cpu == inp->inp_hpts_cpu); - MPASS(!(inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT))); + MPASS(!(inp->inp_flags & INP_DROPPED)); hptsh = &hpts->p_hptss[inp->inp_hptsslot]; @@ -811,7 +811,7 @@ INP_WLOCK_ASSERT(inp); MPASS(!tcp_in_hpts(inp)); - MPASS(!(inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT))); + MPASS(!(inp->inp_flags & INP_DROPPED)); /* * We now return the next-slot the hpts will be on, beyond its @@ -1279,7 +1279,7 @@ } MPASS(inp->inp_in_hpts == IHPTS_ONQUEUE); - MPASS(!(inp->inp_flags & (INP_DROPPED|INP_TIMEWAIT))); + MPASS(!(inp->inp_flags & INP_DROPPED)); KASSERT(runningslot == inp->inp_hptsslot, ("Hpts:%p inp:%p slot mis-aligned %u vs %u", hpts, inp, runningslot, inp->inp_hptsslot)); diff --git a/sys/netinet/tcp_log_buf.c b/sys/netinet/tcp_log_buf.c --- a/sys/netinet/tcp_log_buf.c +++ b/sys/netinet/tcp_log_buf.c @@ -485,7 +485,7 @@ } #define RECHECK_INP_CLEAN(cleanup) do { \ - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { \ + if (inp->inp_flags & INP_DROPPED) { \ rv = ECONNRESET; \ cleanup; \ goto done; \ @@ -2037,7 +2037,7 @@ if (error) { /* Restore list */ INP_WLOCK(inp); - if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0) { + if ((inp->inp_flags & INP_DROPPED) == 0) { tp = intotcpcb(inp); /* Merge the two lists. */ @@ -2211,7 +2211,7 @@ * may end up dropping some entries. That seems like a * small price to pay for safety. */ - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { free(entry, M_TCPLOGDEV); #ifdef TCPLOG_DEBUG_COUNTERS counter_u64_add(tcp_log_que_fail2, 1); diff --git a/sys/netinet/tcp_lro.c b/sys/netinet/tcp_lro.c --- a/sys/netinet/tcp_lro.c +++ b/sys/netinet/tcp_lro.c @@ -1359,8 +1359,7 @@ tp = intotcpcb(inp); /* Check if the inp is dead, Jim. */ - if (tp == NULL || - (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT))) { + if (tp == NULL || (inp->inp_flags & INP_DROPPED)) { INP_WUNLOCK(inp); return (TCP_LRO_CANNOT); } diff --git a/sys/netinet/tcp_stacks/bbr.c b/sys/netinet/tcp_stacks/bbr.c --- a/sys/netinet/tcp_stacks/bbr.c +++ b/sys/netinet/tcp_stacks/bbr.c @@ -14282,7 +14282,7 @@ if (error) return (error); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } diff --git a/sys/netinet/tcp_stacks/rack.c b/sys/netinet/tcp_stacks/rack.c --- a/sys/netinet/tcp_stacks/rack.c +++ b/sys/netinet/tcp_stacks/rack.c @@ -20482,7 +20482,7 @@ if (error) return (error); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c --- a/sys/netinet/tcp_subr.c +++ b/sys/netinet/tcp_subr.c @@ -1373,8 +1373,6 @@ VNET_FOREACH(vnet_iter) { CURVNET_SET(vnet_iter); while ((inp = inp_next(&inpi)) != NULL) { - if (inp->inp_flags & INP_TIMEWAIT) - continue; tp = intotcpcb(inp); if (tp == NULL || tp->t_fb != blk) continue; @@ -1434,8 +1432,6 @@ * useful. */ while ((inpb = inp_next(&inpi)) != NULL) { - if (inpb->inp_flags & INP_TIMEWAIT) - continue; if ((tcpb = intotcpcb(inpb)) != NULL) { tcp_reass_flush(tcpb); tcp_clean_sackreport(tcpb); @@ -2596,8 +2592,7 @@ INP_WLOCK_ASSERT(inp); - if ((inp->inp_flags & INP_TIMEWAIT) || - (inp->inp_flags & INP_DROPPED)) + if (inp->inp_flags & INP_DROPPED) return (inp); tp = intotcpcb(inp); @@ -2879,8 +2874,7 @@ inp = in_pcblookup(&V_tcbinfo, ip->ip_dst, th->th_dport, ip->ip_src, th->th_sport, INPLOOKUP_WLOCKPCB, NULL); if (inp != NULL) { - if (!(inp->inp_flags & INP_TIMEWAIT) && - !(inp->inp_flags & INP_DROPPED) && + if (!(inp->inp_flags & INP_DROPPED) && !(inp->inp_socket == NULL)) { tp = intotcpcb(inp); #ifdef TCP_OFFLOAD @@ -3073,8 +3067,7 @@ } m_copydata(m, off, sizeof(tcp_seq), (caddr_t)&icmp_tcp_seq); if (inp != NULL) { - if (!(inp->inp_flags & INP_TIMEWAIT) && - !(inp->inp_flags & INP_DROPPED) && + if (!(inp->inp_flags & INP_DROPPED) && !(inp->inp_socket == NULL)) { tp = intotcpcb(inp); #ifdef TCP_OFFLOAD @@ -3324,8 +3317,7 @@ NET_EPOCH_ASSERT(); INP_WLOCK_ASSERT(inp); - if ((inp->inp_flags & INP_TIMEWAIT) || - (inp->inp_flags & INP_DROPPED)) + if (inp->inp_flags & INP_DROPPED) return (inp); tp = intotcpcb(inp); @@ -3362,8 +3354,7 @@ struct socket *so; INP_WLOCK_ASSERT(inp); - if ((inp->inp_flags & INP_TIMEWAIT) || - (inp->inp_flags & INP_DROPPED)) + if (inp->inp_flags & INP_DROPPED) return (inp); tp = intotcpcb(inp); @@ -3822,7 +3813,7 @@ } NET_EPOCH_EXIT(et); if (inp != NULL) { - if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) != 0 || + if ((inp->inp_flags & INP_DROPPED) != 0 || inp->inp_socket == NULL) { error = ECONNRESET; INP_WUNLOCK(inp); diff --git a/sys/netinet/tcp_timer.c b/sys/netinet/tcp_timer.c --- a/sys/netinet/tcp_timer.c +++ b/sys/netinet/tcp_timer.c @@ -335,7 +335,7 @@ return; } callout_deactivate(&tp->t_timers->tt_2msl); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); CURVNET_RESTORE(); return; @@ -408,7 +408,7 @@ return; } callout_deactivate(&tp->t_timers->tt_keep); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); CURVNET_RESTORE(); return; @@ -552,7 +552,7 @@ return; } callout_deactivate(&tp->t_timers->tt_persist); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); CURVNET_RESTORE(); return; @@ -636,7 +636,7 @@ return; } callout_deactivate(&tp->t_timers->tt_rexmt); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); CURVNET_RESTORE(); return; diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -264,7 +264,7 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_bind: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { error = EINVAL; goto out; } @@ -314,7 +314,7 @@ KASSERT(inp != NULL, ("tcp6_usr_bind: inp == NULL")); INP_WLOCK(inp); vflagsav = inp->inp_vflag; - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { error = EINVAL; goto out; } @@ -374,7 +374,7 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_listen: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { error = EINVAL; goto out; } @@ -427,7 +427,7 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp6_usr_listen: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { error = EINVAL; goto out; } @@ -511,10 +511,6 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_connect: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & INP_TIMEWAIT) { - error = EADDRINUSE; - goto out; - } if (inp->inp_flags & INP_DROPPED) { error = ECONNREFUSED; goto out; @@ -579,10 +575,6 @@ INP_WLOCK(inp); vflagsav = inp->inp_vflag; incflagsav = inp->inp_inc.inc_flags; - if (inp->inp_flags & INP_TIMEWAIT) { - error = EADDRINUSE; - goto out; - } if (inp->inp_flags & INP_DROPPED) { error = ECONNREFUSED; goto out; @@ -704,8 +696,6 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_disconnect: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & INP_TIMEWAIT) - goto out; if (inp->inp_flags & INP_DROPPED) { error = ECONNRESET; goto out; @@ -744,7 +734,7 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_accept: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { error = ECONNABORTED; goto out; } @@ -794,7 +784,7 @@ KASSERT(inp != NULL, ("tcp6_usr_accept: inp == NULL")); NET_EPOCH_ENTER(et); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { error = ECONNABORTED; goto out; } @@ -847,7 +837,7 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -881,7 +871,7 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_rcvd: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -953,7 +943,7 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_send: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { if (m != NULL && (flags & PRUS_NOTREADY) == 0) m_freem(m); INP_WUNLOCK(inp); @@ -1251,7 +1241,7 @@ inp = sotoinpcb(so); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); mb_free_notready(m, count); return (ECONNRESET); @@ -1294,8 +1284,7 @@ /* * If we still have full TCP state, and we're not dropped, drop. */ - if (!(inp->inp_flags & INP_TIMEWAIT) && - !(inp->inp_flags & INP_DROPPED)) { + if (!(inp->inp_flags & INP_DROPPED)) { tp = intotcpcb(inp); TCPDEBUG1(); tp = tcp_drop(tp, ECONNABORTED); @@ -1336,8 +1325,7 @@ * If we still have full TCP state, and we're not dropped, initiate * a disconnect. */ - if (!(inp->inp_flags & INP_TIMEWAIT) && - !(inp->inp_flags & INP_DROPPED)) { + if (!(inp->inp_flags & INP_DROPPED)) { tp = intotcpcb(inp); tp->t_flags |= TF_CLOSED; TCPDEBUG1(); @@ -1385,7 +1373,7 @@ inp = sotoinpcb(so); KASSERT(inp != NULL, ("tcp_usr_rcvoob: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { error = ECONNRESET; goto out; } @@ -1662,7 +1650,7 @@ */ #define INP_WLOCK_RECHECK_CLEANUP(inp, cleanup) do { \ INP_WLOCK(inp); \ - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { \ + if (inp->inp_flags & INP_DROPPED) { \ INP_WUNLOCK(inp); \ cleanup; \ return (ECONNRESET); \ @@ -1680,7 +1668,7 @@ MPASS(sopt->sopt_dir == SOPT_SET); INP_WLOCK_ASSERT(inp); - KASSERT((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0, + KASSERT((inp->inp_flags & INP_DROPPED) == 0, ("inp_flags == %x", inp->inp_flags)); KASSERT(so != NULL, ("inp_socket == NULL")); @@ -1736,7 +1724,7 @@ return (error); } INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -1754,7 +1742,7 @@ return (error); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -1857,7 +1845,7 @@ MPASS(sopt->sopt_dir == SOPT_GET); INP_WLOCK_ASSERT(inp); - KASSERT((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0, + KASSERT((inp->inp_flags & INP_DROPPED) == 0, ("inp_flags == %x", inp->inp_flags)); KASSERT(so != NULL, ("inp_socket == NULL")); @@ -1907,7 +1895,7 @@ KASSERT(inp != NULL, ("tcp_ctloutput: inp == NULL")); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -2016,7 +2004,7 @@ */ memset(&cc_mem, 0, sizeof(cc_mem)); INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); if (ptr) free(ptr, M_CC_MEM); @@ -2092,7 +2080,7 @@ size_t len; INP_WLOCK_ASSERT(inp); - KASSERT((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) == 0, + KASSERT((inp->inp_flags & INP_DROPPED) == 0, ("inp_flags == %x", inp->inp_flags)); KASSERT(inp->inp_socket != NULL, ("inp_socket == NULL")); diff --git a/sys/netinet/toecore.c b/sys/netinet/toecore.c --- a/sys/netinet/toecore.c +++ b/sys/netinet/toecore.c @@ -220,7 +220,7 @@ KASSERT(inp->inp_pcbinfo == &V_tcbinfo, ("%s: inp is not a TCP inp", __func__)); - if (inp->inp_flags & (INP_DROPPED | INP_TIMEWAIT)) + if (inp->inp_flags & INP_DROPPED) return; tp = intotcpcb(inp); diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -255,7 +255,6 @@ INPLOOKUP_WILDCARD, cred); if (t && ((inp->inp_flags2 & INP_BINDMULTI) == 0) && - ((t->inp_flags & INP_TIMEWAIT) == 0) && (so->so_type != SOCK_STREAM || IN6_IS_ADDR_UNSPECIFIED(&t->in6p_faddr)) && (!IN6_IS_ADDR_UNSPECIFIED(&sin6->sin6_addr) || @@ -286,8 +285,6 @@ INPLOOKUP_WILDCARD, cred); if (t && ((inp->inp_flags2 & INP_BINDMULTI) == 0) && - ((t->inp_flags & - INP_TIMEWAIT) == 0) && (so->so_type != SOCK_STREAM || ntohl(t->inp_faddr.s_addr) == INADDR_ANY) && diff --git a/sys/netinet6/ip6_output.c b/sys/netinet6/ip6_output.c --- a/sys/netinet6/ip6_output.c +++ b/sys/netinet6/ip6_output.c @@ -1844,7 +1844,7 @@ break; } INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -1990,7 +1990,7 @@ { struct ip6_pktopts **optp; INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -2082,7 +2082,7 @@ optlen = sopt->sopt_valsize; optbuf = optbuf_storage; INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); } @@ -2577,7 +2577,7 @@ optdata = malloc(sopt->sopt_valsize, M_TEMP, M_WAITOK); \ malloc_optdata = true; \ INP_RLOCK(inp); \ - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { \ + if (inp->inp_flags & INP_DROPPED) { \ INP_RUNLOCK(inp); \ free(optdata, M_TEMP); \ return (ECONNRESET); \ diff --git a/sys/netipsec/xform_tcp.c b/sys/netipsec/xform_tcp.c --- a/sys/netipsec/xform_tcp.c +++ b/sys/netipsec/xform_tcp.c @@ -86,7 +86,7 @@ if (sopt->sopt_dir == SOPT_GET) { INP_RLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_RUNLOCK(inp); return (ECONNRESET); } @@ -104,7 +104,7 @@ /* INP_WLOCK_RECHECK */ INP_WLOCK(inp); - if (inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) { + if (inp->inp_flags & INP_DROPPED) { INP_WUNLOCK(inp); return (ECONNRESET); }