git: 2096ad13524e - main - pf: sprinkle const in pf_pull_hdr()

From: Kristof Provost <kp_at_FreeBSD.org>
Date: Tue, 27 Aug 2024 14:46:11 UTC
The branch main has been updated by kp:

URL: https://cgit.FreeBSD.org/src/commit/?id=2096ad13524e5bc6ace98877dd62583ba1ec3f82

commit 2096ad13524e5bc6ace98877dd62583ba1ec3f82
Author:     Kristof Provost <kp@FreeBSD.org>
AuthorDate: 2024-08-26 17:08:04 +0000
Commit:     Kristof Provost <kp@FreeBSD.org>
CommitDate: 2024-08-27 14:45:46 +0000

    pf: sprinkle const in pf_pull_hdr()
    
    Sponsored by:   Rubicon Communications, LLC ("Netgate")
---
 sys/net/pfvar.h     | 2 +-
 sys/netpfil/pf/pf.c | 6 +++---
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/sys/net/pfvar.h b/sys/net/pfvar.h
index d66e6f799761..10bf527c025d 100644
--- a/sys/net/pfvar.h
+++ b/sys/net/pfvar.h
@@ -2329,7 +2329,7 @@ int	pf_multihome_scan_asconf(struct mbuf *, int, int, struct pf_pdesc *,
 	    struct pfi_kkif *);
 
 u_int32_t	pf_new_isn(struct pf_kstate *);
-void   *pf_pull_hdr(struct mbuf *, int, void *, int, u_short *, u_short *,
+void   *pf_pull_hdr(const struct mbuf *, int, void *, int, u_short *, u_short *,
 	    sa_family_t);
 void	pf_change_a(void *, u_int16_t *, u_int32_t, u_int8_t);
 void	pf_change_proto_a(struct mbuf *, void *, u_int16_t *, u_int32_t,
diff --git a/sys/netpfil/pf/pf.c b/sys/netpfil/pf/pf.c
index cb69d06b1fe6..acbaf304995f 100644
--- a/sys/netpfil/pf/pf.c
+++ b/sys/netpfil/pf/pf.c
@@ -7422,13 +7422,13 @@ pf_test_state_other(struct pf_kstate **state, struct pfi_kkif *kif,
  * h must be at "ipoff" on the mbuf chain.
  */
 void *
-pf_pull_hdr(struct mbuf *m, int off, void *p, int len,
+pf_pull_hdr(const struct mbuf *m, int off, void *p, int len,
     u_short *actionp, u_short *reasonp, sa_family_t af)
 {
 	switch (af) {
 #ifdef INET
 	case AF_INET: {
-		struct ip	*h = mtod(m, struct ip *);
+		const struct ip	*h = mtod(m, struct ip *);
 		u_int16_t	 fragoff = (ntohs(h->ip_off) & IP_OFFMASK) << 3;
 
 		if (fragoff) {
@@ -7451,7 +7451,7 @@ pf_pull_hdr(struct mbuf *m, int off, void *p, int len,
 #endif /* INET */
 #ifdef INET6
 	case AF_INET6: {
-		struct ip6_hdr	*h = mtod(m, struct ip6_hdr *);
+		const struct ip6_hdr	*h = mtod(m, struct ip6_hdr *);
 
 		if (m->m_pkthdr.len < off + len ||
 		    (ntohs(h->ip6_plen) + sizeof(struct ip6_hdr)) <