git: e81fcbece8df - main - ipfw: Constify name argument for hash lookup

From: Justin Hibbits <jhibbits_at_FreeBSD.org>
Date: Tue, 20 Dec 2022 16:23:34 UTC
The branch main has been updated by jhibbits:

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

commit e81fcbece8df220ce0d072576419a95c6083a0bb
Author:     Justin Hibbits <jhibbits@FreeBSD.org>
AuthorDate: 2022-12-16 18:16:52 +0000
Commit:     Justin Hibbits <jhibbits@FreeBSD.org>
CommitDate: 2022-12-20 16:18:49 +0000

    ipfw: Constify name argument for hash lookup
    
    The name doesn't get modified, and it gets passed through to a hash
    function that accepts only a const pointer.  Const it for correctness.
    
    Sponsored by:   Juniper Networks, Inc.
---
 sys/netpfil/ipfw/ip_fw_private.h | 2 +-
 sys/netpfil/ipfw/ip_fw_sockopt.c | 3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/sys/netpfil/ipfw/ip_fw_private.h b/sys/netpfil/ipfw/ip_fw_private.h
index 1440b1a40eee..87a40c940c23 100644
--- a/sys/netpfil/ipfw/ip_fw_private.h
+++ b/sys/netpfil/ipfw/ip_fw_private.h
@@ -719,7 +719,7 @@ void ipfw_objhash_bitmap_swap(struct namedobj_instance *ni,
 void ipfw_objhash_bitmap_free(void *idx, int blocks);
 void ipfw_objhash_set_hashf(struct namedobj_instance *ni, objhash_hash_f *f);
 struct named_object *ipfw_objhash_lookup_name(struct namedobj_instance *ni,
-    uint32_t set, char *name);
+    uint32_t set, const char *name);
 struct named_object *ipfw_objhash_lookup_name_type(struct namedobj_instance *ni,
     uint32_t set, uint32_t type, const char *name);
 struct named_object *ipfw_objhash_lookup_kidx(struct namedobj_instance *ni,
diff --git a/sys/netpfil/ipfw/ip_fw_sockopt.c b/sys/netpfil/ipfw/ip_fw_sockopt.c
index 8348f8644347..e8dd59eacc09 100644
--- a/sys/netpfil/ipfw/ip_fw_sockopt.c
+++ b/sys/netpfil/ipfw/ip_fw_sockopt.c
@@ -4395,7 +4395,8 @@ objhash_hash_idx(struct namedobj_instance *ni, uint32_t val)
 }
 
 struct named_object *
-ipfw_objhash_lookup_name(struct namedobj_instance *ni, uint32_t set, char *name)
+ipfw_objhash_lookup_name(struct namedobj_instance *ni, uint32_t set,
+    const char *name)
 {
 	struct named_object *no;
 	uint32_t hash;