diff options
author | Robert Watson <rwatson@FreeBSD.org> | 2009-03-26 14:20:16 +0000 |
---|---|---|
committer | Robert Watson <rwatson@FreeBSD.org> | 2009-03-26 14:20:16 +0000 |
commit | 7314f96f1e611b430d61b288aacff7a3977c7058 (patch) | |
tree | 940565ae616b5cb45340e797ee2918903e2ee8ab | |
parent | 39cfbfd4478e7fb860f04c890d259f4079fc2188 (diff) |
Notes
-rw-r--r-- | sys/netinet/in_pcb.c | 14 | ||||
-rw-r--r-- | sys/netinet/in_pcb.h | 1 |
2 files changed, 11 insertions, 4 deletions
diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 6e765848cf12..28a8b7e51776 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,7 +1,7 @@ /*- * Copyright (c) 1982, 1986, 1991, 1993, 1995 * The Regents of the University of California. - * Copyright (c) 2007 Robert N. M. Watson + * Copyright (c) 2007-2009 Robert N. M. Watson * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -955,7 +955,7 @@ in_pcbdrop(struct inpcb *inp) INP_WLOCK_ASSERT(inp); inp->inp_vflag |= INP_DROPPED; - if (inp->inp_lport) { + if (inp->inp_flags & INP_INHASHLIST) { struct inpcbport *phd = inp->inp_phd; LIST_REMOVE(inp, inp_hash); @@ -964,7 +964,7 @@ in_pcbdrop(struct inpcb *inp) LIST_REMOVE(phd, phd_hash); free(phd, M_PCB); } - inp->inp_lport = 0; + inp->inp_flags &= ~INP_INHASHLIST; } } @@ -1344,6 +1344,8 @@ in_pcbinshash(struct inpcb *inp) INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); + KASSERT((inp->inp_flags & INP_INHASHLIST) == 0, + ("in_pcbinshash: INP_INHASHLIST")); #ifdef INET6 if (inp->inp_vflag & INP_IPV6) @@ -1380,6 +1382,7 @@ in_pcbinshash(struct inpcb *inp) inp->inp_phd = phd; LIST_INSERT_HEAD(&phd->phd_pcblist, inp, inp_portlist); LIST_INSERT_HEAD(pcbhash, inp, inp_hash); + inp->inp_flags |= INP_INHASHLIST; return (0); } @@ -1398,6 +1401,8 @@ in_pcbrehash(struct inpcb *inp) INP_INFO_WLOCK_ASSERT(pcbinfo); INP_WLOCK_ASSERT(inp); + KASSERT(inp->inp_flags & INP_INHASHLIST, + ("in_pcbrehash: !INP_INHASHLIST")); #ifdef INET6 if (inp->inp_vflag & INP_IPV6) @@ -1425,7 +1430,7 @@ in_pcbremlists(struct inpcb *inp) INP_WLOCK_ASSERT(inp); inp->inp_gencnt = ++pcbinfo->ipi_gencnt; - if (inp->inp_lport) { + if (inp->inp_flags & INP_INHASHLIST) { struct inpcbport *phd = inp->inp_phd; LIST_REMOVE(inp, inp_hash); @@ -1434,6 +1439,7 @@ in_pcbremlists(struct inpcb *inp) LIST_REMOVE(phd, phd_hash); free(phd, M_PCB); } + inp->inp_flags &= ~INP_INHASHLIST; } LIST_REMOVE(inp, inp_list); pcbinfo->ipi_count--; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 18045b704d16..be52d8cab74c 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -436,6 +436,7 @@ void inp_4tuple_get(struct inpcb *inp, uint32_t *laddr, uint16_t *lp, #define INP_FAITH 0x200 /* accept FAITH'ed connections */ #define INP_RECVTTL 0x400 /* receive incoming IP TTL */ #define INP_DONTFRAG 0x800 /* don't fragment packet */ +#define INP_INHASHLIST 0x2000 /* in_pcbinshash() has been called */ #define IN6P_IPV6_V6ONLY 0x008000 /* restrict AF_INET6 socket for v6 */ |