From ad6c4bdc4276fa275836d25967b059d9cd031380 Mon Sep 17 00:00:00 2001 From: bluhm Date: Tue, 9 Jan 2024 19:57:00 +0000 Subject: [PATCH] Convert some struct inpcb parameter to const pointer. OK millert@ --- sys/netinet/in_pcb.c | 14 +++++++------- sys/netinet/in_pcb.h | 12 ++++++------ sys/netinet6/in6_pcb.c | 10 +++++----- sys/netinet6/in6_src.c | 4 ++-- 4 files changed, 20 insertions(+), 20 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 1d40a0c2d3e..5ac1e8d0a89 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.283 2024/01/01 22:16:51 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.284 2024/01/09 19:57:00 bluhm Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -133,7 +133,7 @@ uint64_t in_pcblhash(struct inpcbtable *, u_int, u_short); struct inpcb *in_pcblookup_lock(struct inpcbtable *, struct in_addr, u_int, struct in_addr, u_int, u_int, int); -int in_pcbaddrisavail_lock(struct inpcb *, struct sockaddr_in *, int, +int in_pcbaddrisavail_lock(const struct inpcb *, struct sockaddr_in *, int, struct proc *, int); int in_pcbpickport(u_int16_t *, const void *, int, const struct inpcb *, struct proc *); @@ -365,8 +365,8 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p) } int -in_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in *sin, int wild, - struct proc *p, int lock) +in_pcbaddrisavail_lock(const struct inpcb *inp, struct sockaddr_in *sin, + int wild, struct proc *p, int lock) { struct socket *so = inp->inp_socket; struct inpcbtable *table = inp->inp_table; @@ -436,8 +436,8 @@ in_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in *sin, int wild, } int -in_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in *sin, int wild, - struct proc *p) +in_pcbaddrisavail(const struct inpcb *inp, struct sockaddr_in *sin, + int wild, struct proc *p) { return in_pcbaddrisavail_lock(inp, sin, wild, p, IN_PCBLOCK_GRAB); } @@ -962,7 +962,7 @@ in_pcbselsrc(struct in_addr *insrc, struct sockaddr_in *sin, { struct ip_moptions *mopts = inp->inp_moptions; struct route *ro = &inp->inp_route; - struct in_addr *laddr = &inp->inp_laddr; + const struct in_addr *laddr = &inp->inp_laddr; u_int rtableid = inp->inp_rtableid; struct sockaddr *ip4_source = NULL; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 7f976d76eef..a98de28ed01 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.h,v 1.147 2024/01/03 11:07:04 bluhm Exp $ */ +/* $OpenBSD: in_pcb.h,v 1.148 2024/01/09 19:57:00 bluhm Exp $ */ /* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */ /* @@ -315,7 +315,7 @@ void in_losing(struct inpcb *); int in_pcballoc(struct socket *, struct inpcbtable *, int); int in_pcbbind_locked(struct inpcb *, struct mbuf *, struct proc *); int in_pcbbind(struct inpcb *, struct mbuf *, struct proc *); -int in_pcbaddrisavail(struct inpcb *, struct sockaddr_in *, int, +int in_pcbaddrisavail(const struct inpcb *, struct sockaddr_in *, int, struct proc *); int in_pcbconnect(struct inpcb *, struct mbuf *); void in_pcbdetach(struct inpcb *); @@ -338,9 +338,9 @@ struct inpcb * struct inpcb * in6_pcblookup_listen(struct inpcbtable *, struct in6_addr *, u_int, struct mbuf *, u_int); -int in6_pcbaddrisavail_lock(struct inpcb *, struct sockaddr_in6 *, int, - struct proc *, int); -int in6_pcbaddrisavail(struct inpcb *, struct sockaddr_in6 *, int, +int in6_pcbaddrisavail_lock(const struct inpcb *, struct sockaddr_in6 *, + int, struct proc *, int); +int in6_pcbaddrisavail(const struct inpcb *, struct sockaddr_in6 *, int, struct proc *); int in6_pcbconnect(struct inpcb *, struct mbuf *); void in6_setsockaddr(struct inpcb *, struct mbuf *); @@ -370,7 +370,7 @@ struct rtentry * void in6_pcbnotify(struct inpcbtable *, struct sockaddr_in6 *, u_int, const struct sockaddr_in6 *, u_int, u_int, int, void *, void (*)(struct inpcb *, int)); -int in6_selecthlim(struct inpcb *); +int in6_selecthlim(const struct inpcb *); int in_pcbset_rtableid(struct inpcb *, u_int); void in_pcbset_laddr(struct inpcb *, const struct sockaddr *, u_int); void in_pcbunset_faddr(struct inpcb *); diff --git a/sys/netinet6/in6_pcb.c b/sys/netinet6/in6_pcb.c index a1bd2bdd1dd..8293704f8dd 100644 --- a/sys/netinet6/in6_pcb.c +++ b/sys/netinet6/in6_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_pcb.c,v 1.131 2023/12/07 16:08:30 bluhm Exp $ */ +/* $OpenBSD: in6_pcb.c,v 1.132 2024/01/09 19:57:01 bluhm Exp $ */ /* * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. @@ -150,8 +150,8 @@ in6_pcbhash(struct inpcbtable *table, u_int rdomain, } int -in6_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild, - struct proc *p, int lock) +in6_pcbaddrisavail_lock(const struct inpcb *inp, struct sockaddr_in6 *sin6, + int wild, struct proc *p, int lock) { struct socket *so = inp->inp_socket; struct inpcbtable *table = inp->inp_table; @@ -240,8 +240,8 @@ in6_pcbaddrisavail_lock(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild, } int -in6_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in6 *sin6, int wild, - struct proc *p) +in6_pcbaddrisavail(const struct inpcb *inp, struct sockaddr_in6 *sin6, + int wild, struct proc *p) { return in6_pcbaddrisavail_lock(inp, sin6, wild, p, IN_PCBLOCK_GRAB); } diff --git a/sys/netinet6/in6_src.c b/sys/netinet6/in6_src.c index 88ec081e954..2c989ec154c 100644 --- a/sys/netinet6/in6_src.c +++ b/sys/netinet6/in6_src.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in6_src.c,v 1.90 2023/12/15 00:24:56 bluhm Exp $ */ +/* $OpenBSD: in6_src.c,v 1.91 2024/01/09 19:57:01 bluhm Exp $ */ /* $KAME: in6_src.c,v 1.36 2001/02/06 04:08:17 itojun Exp $ */ /* @@ -422,7 +422,7 @@ in6_selectif(struct sockaddr_in6 *dstsock, struct ip6_pktopts *opts, } int -in6_selecthlim(struct inpcb *inp) +in6_selecthlim(const struct inpcb *inp) { if (inp && inp->inp_hops >= 0) return (inp->inp_hops); -- 2.20.1