Remove in6_pcbdetach() as it is exactly the same function

as in_pcbdetach() and we don't need the code twice.

Reviewed by:	rwatson
MFC after:	6 weeks (*)
(*) possibly need to leave a stub wrapper in 7 to keep the symbol.
This commit is contained in:
Bjoern A. Zeeb 2008-11-26 20:52:26 +00:00
parent 0eec8b9141
commit 0206cdb846
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=185344
5 changed files with 14 additions and 47 deletions

View File

@ -187,24 +187,15 @@ tcp_detach(struct socket *so, struct inpcb *inp)
if (inp->inp_vflag & INP_DROPPED) {
KASSERT(tp == NULL, ("tcp_detach: INP_TIMEWAIT && "
"INP_DROPPED && tp != NULL"));
#ifdef INET6
if (isipv6) {
in6_pcbdetach(inp);
in6_pcbfree(inp);
} else {
#endif
in_pcbdetach(inp);
in_pcbfree(inp);
#ifdef INET6
}
#endif
} else {
in_pcbdetach(inp);
#ifdef INET6
if (isipv6)
in6_pcbdetach(inp);
in6_pcbfree(inp);
else
#endif
in_pcbdetach(inp);
in_pcbfree(inp);
} else {
in_pcbdetach(inp);
INP_WUNLOCK(inp);
}
} else {
@ -220,23 +211,14 @@ tcp_detach(struct socket *so, struct inpcb *inp)
if (inp->inp_vflag & INP_DROPPED ||
tp->t_state < TCPS_SYN_SENT) {
tcp_discardcb(tp);
#ifdef INET6
if (isipv6) {
in6_pcbdetach(inp);
in6_pcbfree(inp);
} else {
#endif
in_pcbdetach(inp);
in_pcbfree(inp);
#ifdef INET6
}
#endif
} else {
in_pcbdetach(inp);
#ifdef INET6
if (isipv6)
in6_pcbdetach(inp);
in6_pcbfree(inp);
else
#endif
in_pcbfree(inp);
} else {
in_pcbdetach(inp);
}
}
@ -1496,17 +1478,13 @@ tcp_attach(struct socket *so)
inp->inp_vflag |= INP_IPV4;
tp = tcp_newtcpcb(inp);
if (tp == NULL) {
in_pcbdetach(inp);
#ifdef INET6
if (isipv6) {
in6_pcbdetach(inp);
if (isipv6)
in6_pcbfree(inp);
} else {
else
#endif
in_pcbdetach(inp);
in_pcbfree(inp);
#ifdef INET6
}
#endif
INP_INFO_WUNLOCK(&V_tcbinfo);
return (ENOBUFS);
}

View File

@ -410,16 +410,6 @@ in6_pcbdisconnect(struct inpcb *inp)
in_pcbrehash(inp);
}
void
in6_pcbdetach(struct inpcb *inp)
{
KASSERT(inp->inp_socket != NULL, ("%s: inp_socket == NULL", __func__));
inp->inp_socket->so_pcb = NULL;
inp->inp_socket = NULL;
}
void
in6_pcbfree(struct inpcb *inp)
{

View File

@ -73,7 +73,6 @@ void in6_pcbpurgeif0 __P((struct inpcbinfo *, struct ifnet *));
void in6_losing __P((struct inpcb *));
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 *,

View File

@ -604,7 +604,7 @@ rip6_detach(struct socket *so)
INP_INFO_WLOCK(&V_ripcbinfo);
INP_WLOCK(inp);
free(inp->in6p_icmp6filt, M_PCB);
in6_pcbdetach(inp);
in_pcbdetach(inp);
in6_pcbfree(inp);
INP_INFO_WUNLOCK(&V_ripcbinfo);
}

View File

@ -900,7 +900,7 @@ udp6_detach(struct socket *so)
INP_INFO_WLOCK(&V_udbinfo);
INP_WLOCK(inp);
in6_pcbdetach(inp);
in_pcbdetach(inp);
in6_pcbfree(inp);
INP_INFO_WUNLOCK(&V_udbinfo);
}