git: 52ef944b0f6f - main - inpcb: Constify address parameters to in6 pcb lookup routines

From: Mark Johnston <markj_at_FreeBSD.org>
Date: Thu, 14 Nov 2024 20:01:55 UTC
The branch main has been updated by markj:

URL: https://cgit.FreeBSD.org/src/commit/?id=52ef944b0f6f1df8eebe1cb877c6aadb1c247da0

commit 52ef944b0f6f1df8eebe1cb877c6aadb1c247da0
Author:     Mark Johnston <markj@FreeBSD.org>
AuthorDate: 2024-11-14 19:28:03 +0000
Commit:     Mark Johnston <markj@FreeBSD.org>
CommitDate: 2024-11-14 19:59:04 +0000

    inpcb: Constify address parameters to in6 pcb lookup routines
    
    No functional change intended.
    
    MFC after:      1 week
    Sponsored by:   Klara, Inc.
    Sponsored by:   Stormshield
---
 sys/netinet6/in6_pcb.c | 16 ++++++++--------
 sys/netinet6/in6_pcb.h | 22 ++++++++--------------
 2 files changed, 16 insertions(+), 22 deletions(-)

diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c
index 45fdd6541bf7..639ec68e19e2 100644
--- a/sys/netinet6/in6_pcb.c
+++ b/sys/netinet6/in6_pcb.c
@@ -687,7 +687,7 @@ in6_pcbnotify(struct inpcbinfo *pcbinfo, struct sockaddr_in6 *sa6_dst,
  * hash lock.  No inpcb locks or references are acquired.
  */
 struct inpcb *
-in6_pcblookup_local(struct inpcbinfo *pcbinfo, struct in6_addr *laddr,
+in6_pcblookup_local(struct inpcbinfo *pcbinfo, const struct in6_addr *laddr,
     u_short lport, int lookupflags, struct ucred *cred)
 {
 	struct inpcb *inp;
@@ -1148,9 +1148,9 @@ in6_pcblookup_hash(struct inpcbinfo *pcbinfo, const struct in6_addr *faddr,
 }
 
 static struct inpcb *
-in6_pcblookup_hash_smr(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
-    u_int fport_arg, struct in6_addr *laddr, u_int lport_arg, int lookupflags,
-    uint8_t numa_domain)
+in6_pcblookup_hash_smr(struct inpcbinfo *pcbinfo, const struct in6_addr *faddr,
+    u_int fport_arg, const struct in6_addr *laddr, u_int lport_arg,
+    int lookupflags, uint8_t numa_domain)
 {
 	struct inpcb *inp;
 	const inp_lookup_t lockflags = lookupflags & INPLOOKUP_LOCKMASK;
@@ -1210,8 +1210,8 @@ in6_pcblookup_hash_smr(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
  * from which a pre-calculated hash value may be extracted.
  */
 struct inpcb *
-in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport,
-    struct in6_addr *laddr, u_int lport, int lookupflags,
+in6_pcblookup(struct inpcbinfo *pcbinfo, const struct in6_addr *faddr,
+    u_int fport, const struct in6_addr *laddr, u_int lport, int lookupflags,
     struct ifnet *ifp __unused)
 {
 	return (in6_pcblookup_hash_smr(pcbinfo, faddr, fport, laddr, lport,
@@ -1219,8 +1219,8 @@ in6_pcblookup(struct inpcbinfo *pcbinfo, struct in6_addr *faddr, u_int fport,
 }
 
 struct inpcb *
-in6_pcblookup_mbuf(struct inpcbinfo *pcbinfo, struct in6_addr *faddr,
-    u_int fport, struct in6_addr *laddr, u_int lport, int lookupflags,
+in6_pcblookup_mbuf(struct inpcbinfo *pcbinfo, const struct in6_addr *faddr,
+    u_int fport, const struct in6_addr *laddr, u_int lport, int lookupflags,
     struct ifnet *ifp __unused, struct mbuf *m)
 {
 	return (in6_pcblookup_hash_smr(pcbinfo, faddr, fport, laddr, lport,
diff --git a/sys/netinet6/in6_pcb.h b/sys/netinet6/in6_pcb.h
index b9e1cd38a60f..98a4d27ddb35 100644
--- a/sys/netinet6/in6_pcb.h
+++ b/sys/netinet6/in6_pcb.h
@@ -74,23 +74,17 @@ int	in6_pcbbind(struct inpcb *, struct sockaddr_in6 *, struct ucred *);
 int	in6_pcbconnect(struct inpcb *, struct sockaddr_in6 *, struct ucred *,
 	    bool);
 void	in6_pcbdisconnect(struct inpcb *);
-struct	inpcb *
-	in6_pcblookup_local(struct inpcbinfo *,
-				 struct in6_addr *, u_short, int,
-				 struct ucred *);
-struct inpcb *
-	in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo,
+struct inpcb *in6_pcblookup_local(struct inpcbinfo *, const struct in6_addr *,
+	    u_short, int, struct ucred *);
+struct inpcb *in6_pcblookup_hash_locked(struct inpcbinfo *pcbinfo,
 	    const struct in6_addr *faddr, u_int fport_arg,
 	    const struct in6_addr *laddr, u_int lport_arg,
 	    int lookupflags, uint8_t);
-struct	inpcb *
-	in6_pcblookup(struct inpcbinfo *, struct in6_addr *,
-			   u_int, struct in6_addr *, u_int, int,
-			   struct ifnet *);
-struct	inpcb *
-	in6_pcblookup_mbuf(struct inpcbinfo *, struct in6_addr *,
-			   u_int, struct in6_addr *, u_int, int,
-			   struct ifnet *ifp, struct mbuf *);
+struct inpcb *in6_pcblookup(struct inpcbinfo *, const struct in6_addr *, u_int,
+	    const struct in6_addr *, u_int, int, struct ifnet *);
+struct inpcb *in6_pcblookup_mbuf(struct inpcbinfo *, const struct in6_addr *,
+	    u_int, const struct in6_addr *, u_int, int, struct ifnet *ifp,
+	    struct mbuf *);
 void	in6_pcbnotify(struct inpcbinfo *, struct sockaddr_in6 *, u_int,
 			   const struct sockaddr_in6 *, u_int, int, void *,
 			   struct inpcb *(*)(struct inpcb *, int));