From 06d05a3069abc6cd0170f35da289afd81156ece6 Mon Sep 17 00:00:00 2001 From: bluhm Date: Sun, 12 Nov 2023 23:19:14 +0000 Subject: [PATCH] Declare global variable zeroin46_addr as const. OK mvs@ jca@ --- sys/netinet/in_pcb.c | 18 +++++++++--------- sys/netinet/in_pcb.h | 8 +++++--- 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/sys/netinet/in_pcb.c b/sys/netinet/in_pcb.c index 292a64364bc..d4fa9bdce38 100644 --- a/sys/netinet/in_pcb.c +++ b/sys/netinet/in_pcb.c @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.c,v 1.277 2023/06/24 20:54:46 bluhm Exp $ */ +/* $OpenBSD: in_pcb.c,v 1.278 2023/11/12 23:19:14 bluhm Exp $ */ /* $NetBSD: in_pcb.c,v 1.25 1996/02/13 23:41:53 christos Exp $ */ /* @@ -102,7 +102,7 @@ const struct in_addr zeroin_addr; -union { +const union { struct in_addr za_in; struct in6_addr za_in6; } zeroin46_addr; @@ -271,7 +271,7 @@ in_pcbbind(struct inpcb *inp, struct mbuf *nam, struct proc *p) struct socket *so = inp->inp_socket; u_int16_t lport = 0; int wild = 0; - void *laddr = &zeroin46_addr; + const void *laddr = &zeroin46_addr; int error; if (inp->inp_lport) @@ -415,8 +415,8 @@ in_pcbaddrisavail(struct inpcb *inp, struct sockaddr_in *sin, int wild, } int -in_pcbpickport(u_int16_t *lport, void *laddr, int wild, struct inpcb *inp, - struct proc *p) +in_pcbpickport(u_int16_t *lport, const void *laddr, int wild, + const struct inpcb *inp, struct proc *p) { struct socket *so = inp->inp_socket; struct inpcbtable *table = inp->inp_table; @@ -803,15 +803,15 @@ in_rtchange(struct inpcb *inp, int errno) } struct inpcb * -in_pcblookup_local(struct inpcbtable *table, void *laddrp, u_int lport_arg, - int flags, u_int rtable) +in_pcblookup_local(struct inpcbtable *table, const void *laddrp, + u_int lport_arg, int flags, u_int rtable) { struct inpcb *inp, *match = NULL; int matchwild = 3, wildcard; u_int16_t lport = lport_arg; - struct in_addr laddr = *(struct in_addr *)laddrp; + const struct in_addr laddr = *(const struct in_addr *)laddrp; #ifdef INET6 - struct in6_addr *laddr6 = (struct in6_addr *)laddrp; + const struct in6_addr *laddr6 = (const struct in6_addr *)laddrp; #endif struct inpcbhead *head; uint64_t lhash; diff --git a/sys/netinet/in_pcb.h b/sys/netinet/in_pcb.h index 61c26da36e4..797f4b289da 100644 --- a/sys/netinet/in_pcb.h +++ b/sys/netinet/in_pcb.h @@ -1,4 +1,4 @@ -/* $OpenBSD: in_pcb.h,v 1.136 2023/06/24 20:54:46 bluhm Exp $ */ +/* $OpenBSD: in_pcb.h,v 1.137 2023/11/12 23:19:15 bluhm Exp $ */ /* $NetBSD: in_pcb.h,v 1.14 1996/02/13 23:42:00 christos Exp $ */ /* @@ -312,7 +312,8 @@ int in6_peeraddr(struct socket *, struct mbuf *); #endif /* INET6 */ void in_pcbinit(struct inpcbtable *, int); struct inpcb * - in_pcblookup_local(struct inpcbtable *, void *, u_int, int, u_int); + in_pcblookup_local(struct inpcbtable *, const void *, u_int, int, + u_int); void in_pcbnotifyall(struct inpcbtable *, struct sockaddr *, u_int, int, void (*)(struct inpcb *, int)); void in_pcbrehash(struct inpcb *); @@ -332,6 +333,7 @@ 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 in_pcbpickport(u_int16_t *, void *, int, struct inpcb *, struct proc *); +int in_pcbpickport(u_int16_t *, const void *, int, const struct inpcb *, + struct proc *); #endif /* _KERNEL */ #endif /* _NETINET_IN_PCB_H_ */ -- 2.20.1