From: Sepherosa Ziehau Date: Mon, 21 Feb 2011 02:52:20 +0000 (+0800) Subject: inpcb: Exclusive the usage of wildcard hash and connect hash X-Git-Tag: v2.11.0~267^2~37^2 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/f78f8f4acd8472ae40790490a2e9d963b26ebce3 inpcb: Exclusive the usage of wildcard hash and connect hash DragonFly-bug: http://bugs.dragonflybsd.org/issue1993 --- diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index e82671b843..7d4d26923f 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1171,7 +1171,10 @@ in_pcbinsconnhash(struct inpcb *inp) } #endif - KASSERT(!(inp->inp_flags & INP_CONNECTED), ("already on hash list")); + KASSERT(!(inp->inp_flags & INP_WILDCARD), + ("already on wildcardhash\n")); + KASSERT(!(inp->inp_flags & INP_CONNECTED), + ("already on connhash\n")); inp->inp_flags |= INP_CONNECTED; /* @@ -1265,11 +1268,14 @@ void in_pcbinswildcardhash(struct inpcb *inp) { struct inpcbinfo *pcbinfo = inp->inp_pcbinfo; - - KKASSERT(pcbinfo != NULL); - in_pcbinswildcardhash_oncpu(inp, pcbinfo); + KASSERT(!(inp->inp_flags & INP_CONNECTED), + ("already on connhash\n")); + KASSERT(!(inp->inp_flags & INP_WILDCARD), + ("already on wildcardhash\n")); inp->inp_flags |= INP_WILDCARD; + + in_pcbinswildcardhash_oncpu(inp, pcbinfo); } void diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c index 386096b235..504fb814b3 100644 --- a/sys/netinet/tcp_usrreq.c +++ b/sys/netinet/tcp_usrreq.c @@ -395,6 +395,12 @@ tcp_usr_listen(netmsg_t msg) * We have to set the flag because we can't have other cpus * messing with our inp's flags. */ + KASSERT(!(inp->inp_flags & INP_CONNECTED), + ("already on connhash\n")); + KASSERT(!(inp->inp_flags & INP_WILDCARD), + ("already on wildcardhash\n")); + KASSERT(!(inp->inp_flags & INP_WILDCARD_MP), + ("already on MP wildcardhash\n")); inp->inp_flags |= INP_WILDCARD_MP; KKASSERT(so->so_port == cpu_portfn(0)); @@ -446,6 +452,12 @@ tcp6_usr_listen(netmsg_t msg) * We have to set the flag because we can't have other cpus * messing with our inp's flags. */ + KASSERT(!(inp->inp_flags & INP_CONNECTED), + ("already on connhash\n")); + KASSERT(!(inp->inp_flags & INP_WILDCARD), + ("already on wildcardhash\n")); + KASSERT(!(inp->inp_flags & INP_WILDCARD_MP), + ("already on MP wildcardhash\n")); inp->inp_flags |= INP_WILDCARD_MP; KKASSERT(so->so_port == cpu_portfn(0));