git: 221b9e3d0684 - main - inpcb: merge two versions of in6_pcbconnect() into one

From: Gleb Smirnoff <glebius_at_FreeBSD.org>
Date: Fri, 03 Feb 2023 19:34:19 UTC
The branch main has been updated by glebius:

URL: https://cgit.FreeBSD.org/src/commit/?id=221b9e3d06847afa199423bcaf59fc289998a452

commit 221b9e3d06847afa199423bcaf59fc289998a452
Author:     Gleb Smirnoff <glebius@FreeBSD.org>
AuthorDate: 2023-02-03 19:33:35 +0000
Commit:     Gleb Smirnoff <glebius@FreeBSD.org>
CommitDate: 2023-02-03 19:33:35 +0000

    inpcb: merge two versions of in6_pcbconnect() into one
    
    No functional change.
    
    Reviewed by:            markj
    Differential revision:  https://reviews.freebsd.org/D38354
---
 sys/netinet/tcp_syncache.c |  4 ++--
 sys/netinet/tcp_usrreq.c   |  2 +-
 sys/netinet6/in6_pcb.c     | 11 ++---------
 sys/netinet6/in6_pcb.h     |  4 +---
 sys/netinet6/udp6_usrreq.c |  2 +-
 5 files changed, 7 insertions(+), 16 deletions(-)

diff --git a/sys/netinet/tcp_syncache.c b/sys/netinet/tcp_syncache.c
index 1a4cde642d4a..2b817fee7260 100644
--- a/sys/netinet/tcp_syncache.c
+++ b/sys/netinet/tcp_syncache.c
@@ -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;
diff --git a/sys/netinet/tcp_usrreq.c b/sys/netinet/tcp_usrreq.c
index 8cc5894171de..5d82e5138538 100644
--- a/sys/netinet/tcp_usrreq.c
+++ b/sys/netinet/tcp_usrreq.c
@@ -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);
diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 51d29399e99b..aed0f26f89ba 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -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)
 {
diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h
index 09907e2c397c..bf84576736e4 100644
--- a/sys/netinet6/in6_pcb.h
+++ b/sys/netinet6/in6_pcb.h
@@ -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 *,
diff --git a/sys/netinet6/udp6_usrreq.c b/sys/netinet6/udp6_usrreq.c
index b79a00280110..1ab838d60ac0 100644
--- a/sys/netinet6/udp6_usrreq.c
+++ b/sys/netinet6/udp6_usrreq.c
@@ -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