inpcb: merge two versions of in6_pcbconnect() into one

No functional change.

Reviewed by:		markj
Differential revision:	https://reviews.freebsd.org/D38354
This commit is contained in:
Gleb Smirnoff 2023-02-03 11:33:35 -08:00
parent 76f1499ff5
commit 221b9e3d06
5 changed files with 7 additions and 16 deletions

View File

@ -882,8 +882,8 @@ syncache_socket(struct syncache *sc, struct socket *lso, struct mbuf *m)
if (IN6_IS_ADDR_UNSPECIFIED(&inp->in6p_laddr))
inp->in6p_laddr = sc->sc_inc.inc6_laddr;
INP_HASH_WLOCK(&V_tcbinfo);
error = in6_pcbconnect_mbuf(inp, (struct sockaddr *)&sin6,
thread0.td_ucred, m, false);
error = in6_pcbconnect(inp, (struct sockaddr *)&sin6,
thread0.td_ucred, false);
INP_HASH_WUNLOCK(&V_tcbinfo);
if (error != 0) {
inp->in6p_laddr = laddr6;

View File

@ -1476,7 +1476,7 @@ tcp6_connect(struct tcpcb *tp, struct sockaddr *nam, struct thread *td)
INP_WLOCK_ASSERT(inp);
INP_HASH_WLOCK(&V_tcbinfo);
error = in6_pcbconnect(inp, nam, td->td_ucred);
error = in6_pcbconnect(inp, nam, td->td_ucred, true);
INP_HASH_WUNLOCK(&V_tcbinfo);
if (error != 0)
return (error);

View File

@ -414,8 +414,8 @@ in6_pcbladdr(struct inpcb *inp, struct sockaddr_in6 *sin6,
* then pick one.
*/
int
in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
struct ucred *cred, struct mbuf *m, bool rehash)
in6_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred,
bool rehash)
{
struct inpcbinfo *pcbinfo = inp->inp_pcbinfo;
struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *)nam;
@ -497,13 +497,6 @@ in6_pcbconnect_mbuf(struct inpcb *inp, struct sockaddr *nam,
return (0);
}
int
in6_pcbconnect(struct inpcb *inp, struct sockaddr *nam, struct ucred *cred)
{
return (in6_pcbconnect_mbuf(inp, nam, cred, NULL, true));
}
void
in6_pcbdisconnect(struct inpcb *inp)
{

View File

@ -74,9 +74,7 @@
void in6_pcbpurgeif0(struct inpcbinfo *, struct ifnet *);
void in6_losing(struct inpcb *);
int in6_pcbbind(struct inpcb *, struct sockaddr *, struct ucred *);
int in6_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *);
int in6_pcbconnect_mbuf(struct inpcb *, struct sockaddr *,
struct ucred *, struct mbuf *, bool);
int in6_pcbconnect(struct inpcb *, struct sockaddr *, struct ucred *, bool);
void in6_pcbdisconnect(struct inpcb *);
struct inpcb *
in6_pcblookup_local(struct inpcbinfo *,

View File

@ -1182,7 +1182,7 @@ udp6_connect(struct socket *so, struct sockaddr *nam, struct thread *td)
inp->inp_vflag &= ~INP_IPV4;
inp->inp_vflag |= INP_IPV6;
INP_HASH_WLOCK(pcbinfo);
error = in6_pcbconnect(inp, nam, td->td_ucred);
error = in6_pcbconnect(inp, nam, td->td_ucred, true);
INP_HASH_WUNLOCK(pcbinfo);
/*
* If connect succeeds, mark socket as connected. If