diff options
Diffstat (limited to 'sys/netinet6')
-rw-r--r-- | sys/netinet6/in6_pcb.c | 24 | ||||
-rw-r--r-- | sys/netinet6/in6_pcb.h | 1 |
2 files changed, 12 insertions, 13 deletions
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index d2a03e3..cc0d678 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -422,17 +422,23 @@ in6_pcbdisconnect(inp) #ifdef IPSEC ipsec_pcbdisconn(inp->inp_sp); #endif - if (inp->inp_socket->so_state & SS_NOFDREF) - in6_pcbdetach(inp); } void -in6_pcbdetach(inp) - struct inpcb *inp; +in6_pcbdetach(struct inpcb *inp) +{ + + KASSERT(inp->inp_socket != NULL, ("in6_pcbdetach: inp_socket == NULL")); + inp->inp_socket->so_pcb = NULL; + inp->inp_socket = NULL; +} + +void +in6_pcbfree(struct inpcb *inp) { - struct socket *so = inp->inp_socket; struct inpcbinfo *ipi = inp->inp_pcbinfo; + KASSERT(inp->inp_socket == NULL, ("in6_pcbfree: inp_socket != NULL")); INP_INFO_WLOCK_ASSERT(inp->inp_pcbinfo); INP_LOCK_ASSERT(inp); @@ -442,14 +448,6 @@ in6_pcbdetach(inp) #endif /* IPSEC */ inp->inp_gencnt = ++ipi->ipi_gencnt; in_pcbremlists(inp); - - if (so) { - ACCEPT_LOCK(); - SOCK_LOCK(so); - so->so_pcb = NULL; - sotryfree(so); - } - ip6_freepcbopts(inp->in6p_outputopts); ip6_freemoptions(inp->in6p_moptions); /* Check and free IPv4 related resources in case of mapped addr */ diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h index 45b46f1..52e566a 100644 --- a/sys/netinet6/in6_pcb.h +++ b/sys/netinet6/in6_pcb.h @@ -76,6 +76,7 @@ int in6_pcbbind __P((struct inpcb *, struct sockaddr *, struct ucred *)); int in6_pcbconnect __P((struct inpcb *, struct sockaddr *, struct ucred *)); void in6_pcbdetach __P((struct inpcb *)); void in6_pcbdisconnect __P((struct inpcb *)); +void in6_pcbfree __P((struct inpcb *)); int in6_pcbladdr __P((struct inpcb *, struct sockaddr *, struct in6_addr **)); struct inpcb * |