Hello -
This constify's ether_sprintf and some globals and adjusts the users
accordingly.

Feel free to commit if OK.

Index: dev/ic/if_wi_hostap.c
===================================================================
RCS file: /cvs/src/sys/dev/ic/if_wi_hostap.c,v
retrieving revision 1.52
diff -u -p -r1.52 if_wi_hostap.c
--- dev/ic/if_wi_hostap.c       19 Feb 2018 08:59:52 -0000      1.52
+++ dev/ic/if_wi_hostap.c       14 Dec 2022 15:32:35 -0000
@@ -76,13 +76,13 @@ struct wihap_sta_info *wihap_sta_find(st
 int wihap_sta_is_assoc(struct wihap_info *whi, u_int8_t addr[]);
 void wihap_auth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
     caddr_t pkt, int len);
-void wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[],
+void wihap_sta_deauth(struct wi_softc *sc, const u_int8_t sta_addr[],
     u_int16_t reason);
 void wihap_deauth_req(struct wi_softc *sc, struct wi_frame *rxfrm,
     caddr_t pkt, int len);
 void wihap_assoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
     caddr_t pkt, int len);
-void wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[],
+void wihap_sta_disassoc(struct wi_softc *sc, const u_int8_t sta_addr[],
     u_int16_t reason);
 void wihap_disassoc_req(struct wi_softc *sc, struct wi_frame *rxfrm,
     caddr_t pkt, int len);
@@ -204,7 +204,7 @@ wihap_init(struct wi_softc *sc)
  *     Send a disassociation frame to a specified station.
  */
 void
-wihap_sta_disassoc(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason) +wihap_sta_disassoc(struct wi_softc *sc, const u_int8_t sta_addr[], u_int16_t reason)
 {
        struct wi_80211_hdr     *resp_hdr;
        caddr_t                 pkt;
@@ -233,7 +233,7 @@ wihap_sta_disassoc(struct wi_softc *sc,
  *     Send a deauthentication message to a specified station.
  */
 void
-wihap_sta_deauth(struct wi_softc *sc, u_int8_t sta_addr[], u_int16_t reason) +wihap_sta_deauth(struct wi_softc *sc, const u_int8_t sta_addr[], u_int16_t reason)
 {
        struct wi_80211_hdr     *resp_hdr;
        caddr_t                 pkt;
Index: dev/pci/if_bwfm_pci.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_bwfm_pci.c,v
retrieving revision 1.74
diff -u -p -r1.74 if_bwfm_pci.c
--- dev/pci/if_bwfm_pci.c       10 Nov 2022 12:14:05 -0000      1.74
+++ dev/pci/if_bwfm_pci.c       14 Dec 2022 15:32:35 -0000
@@ -1929,7 +1929,7 @@ bwfm_pci_flowring_lookup(struct bwfm_pci
 {
        struct ieee80211com *ic = &sc->sc_sc.sc_ic;
 #ifndef IEEE80211_STA_ONLY
-       uint8_t *da = mtod(m, uint8_t *);
+       const uint8_t *da = mtod(m, uint8_t *);
 #endif
        int flowid, prio, fifo;
        int i, found;
@@ -1987,7 +1987,7 @@ bwfm_pci_flowring_create(struct bwfm_pci
        struct ieee80211com *ic = &sc->sc_sc.sc_ic;
        struct bwfm_cmd_flowring_create cmd;
 #ifndef IEEE80211_STA_ONLY
-       uint8_t *da = mtod(m, uint8_t *);
+       const uint8_t *da = mtod(m, uint8_t *);
 #endif
        struct bwfm_pci_msgring *ring;
        int flowid, prio, fifo;
Index: dev/pci/if_ixl.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_ixl.c,v
retrieving revision 1.84
diff -u -p -r1.84 if_ixl.c
--- dev/pci/if_ixl.c    5 Aug 2022 13:57:16 -0000       1.84
+++ dev/pci/if_ixl.c    14 Dec 2022 15:32:35 -0000
@@ -1346,7 +1346,7 @@ static int        ixl_set_vsi(struct ixl_softc
 static int     ixl_get_link_status(struct ixl_softc *);
 static int     ixl_set_link_status(struct ixl_softc *,
                    const struct ixl_aq_desc *);
-static int     ixl_add_macvlan(struct ixl_softc *, uint8_t *, uint16_t,
+static int     ixl_add_macvlan(struct ixl_softc *, const uint8_t *, uint16_t,
                    uint16_t);
 static int     ixl_remove_macvlan(struct ixl_softc *, uint8_t *, uint16_t,
                    uint16_t);
@@ -4547,7 +4547,7 @@ ixl_restart_an(struct ixl_softc *sc)
 }

 static int
-ixl_add_macvlan(struct ixl_softc *sc, uint8_t *macaddr, uint16_t vlan, uint16_t flags) +ixl_add_macvlan(struct ixl_softc *sc, const uint8_t *macaddr, uint16_t vlan, uint16_t flags)
 {
        struct ixl_aq_desc iaq;
        struct ixl_aq_add_macvlan *param;
Index: dev/pci/if_mcx.c
===================================================================
RCS file: /cvs/src/sys/dev/pci/if_mcx.c,v
retrieving revision 1.106
diff -u -p -r1.106 if_mcx.c
--- dev/pci/if_mcx.c    22 Nov 2022 06:48:32 -0000      1.106
+++ dev/pci/if_mcx.c    14 Dec 2022 15:32:36 -0000
@@ -2564,7 +2564,7 @@ static int        mcx_create_flow_group(struct
                    int, int, struct mcx_flow_match *);
 static int     mcx_destroy_flow_group(struct mcx_softc *, int);
 static int     mcx_set_flow_table_entry_mac(struct mcx_softc *, int, int,
-                   uint8_t *, uint32_t);
+                   const uint8_t *, uint32_t);
 static int     mcx_set_flow_table_entry_proto(struct mcx_softc *, int, int,
                    int, int, uint32_t);
 static int     mcx_delete_flow_table_entry(struct mcx_softc *, int, int);
@@ -5855,7 +5855,7 @@ free:

 static int
 mcx_set_flow_table_entry_mac(struct mcx_softc *sc, int group, int index,
-    uint8_t *macaddr, uint32_t dest)
+    const uint8_t *macaddr, uint32_t dest)
 {
        struct mcx_cmdq_entry *cqe;
        struct mcx_dmamem mxm;
Index: net/if_ethersubr.c
===================================================================
RCS file: /cvs/src/sys/net/if_ethersubr.c,v
retrieving revision 1.284
diff -u -p -r1.284 if_ethersubr.c
--- net/if_ethersubr.c  29 Jun 2022 09:08:07 -0000      1.284
+++ net/if_ethersubr.c  14 Dec 2022 15:32:36 -0000
@@ -136,9 +136,9 @@ didn't get a copy, you may request one f
 #include <netmpls/mpls.h>
 #endif /* MPLS */

-u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN] =
+const u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN] =
     { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
-u_int8_t etheranyaddr[ETHER_ADDR_LEN] =
+const u_int8_t etheranyaddr[ETHER_ADDR_LEN] =
     { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
 #define senderr(e) { error = (e); goto bad;}

@@ -632,9 +632,9 @@ ether_brport_get_locked(struct ifnet *if
 /*
  * Convert Ethernet address to printable (loggable) representation.
  */
-static char digits[] = "0123456789abcdef";
+const static char digits[] = "0123456789abcdef";
 char *
-ether_sprintf(u_char *ap)
+ether_sprintf(const u_char *ap)
 {
        int i;
        static char etherbuf[ETHER_ADDR_LEN * 3];
@@ -822,15 +822,15 @@ ether_crc32_be(const u_int8_t *buf, size
        return ether_crc32_be_update(0xffffffff, buf, len);
 }

-u_char ether_ipmulticast_min[ETHER_ADDR_LEN] =
+const u_char   ether_ipmulticast_min[ETHER_ADDR_LEN] =
     { 0x01, 0x00, 0x5e, 0x00, 0x00, 0x00 };
-u_char ether_ipmulticast_max[ETHER_ADDR_LEN] =
+const u_char   ether_ipmulticast_max[ETHER_ADDR_LEN] =
     { 0x01, 0x00, 0x5e, 0x7f, 0xff, 0xff };

 #ifdef INET6
-u_char ether_ip6multicast_min[ETHER_ADDR_LEN] =
+const u_char   ether_ip6multicast_min[ETHER_ADDR_LEN] =
     { 0x33, 0x33, 0x00, 0x00, 0x00, 0x00 };
-u_char ether_ip6multicast_max[ETHER_ADDR_LEN] =
+const u_char   ether_ip6multicast_max[ETHER_ADDR_LEN] =
     { 0x33, 0x33, 0xff, 0xff, 0xff, 0xff };
 #endif

Index: net/ppp_tty.c
===================================================================
RCS file: /cvs/src/sys/net/ppp_tty.c,v
retrieving revision 1.54
diff -u -p -r1.54 ppp_tty.c
--- net/ppp_tty.c       2 Jan 2022 22:36:04 -0000       1.54
+++ net/ppp_tty.c       14 Dec 2022 15:32:36 -0000
@@ -439,7 +439,7 @@ ppptioctl(struct tty *tp, u_long cmd, ca
 /*
  * FCS lookup table as calculated by genfcstab.
  */
-static u_int16_t fcstab[256] = {
+const static u_int16_t fcstab[256] = {
        0x0000, 0x1189, 0x2312, 0x329b, 0x4624, 0x57ad, 0x6536, 0x74bf,
        0x8c48, 0x9dc1, 0xaf5a, 0xbed3, 0xca6c, 0xdbe5, 0xe97e, 0xf8f7,
        0x1081, 0x0108, 0x3393, 0x221a, 0x56a5, 0x472c, 0x75b7, 0x643e,
@@ -786,7 +786,7 @@ ppp_pkt_free(struct ppp_pkt *pkt)
 /*
  * tty interface receiver interrupt.
  */
-static unsigned int paritytab[8] = {
+const static unsigned int paritytab[8] = {
     0x96696996, 0x69969669, 0x69969669, 0x96696996,
     0x69969669, 0x96696996, 0x96696996, 0x69969669
 };
Index: netinet/if_ether.h
===================================================================
RCS file: /cvs/src/sys/netinet/if_ether.h,v
retrieving revision 1.83
diff -u -p -r1.83 if_ether.h
--- netinet/if_ether.h  7 Jul 2021 20:19:01 -0000       1.83
+++ netinet/if_ether.h  14 Dec 2022 15:32:36 -0000
@@ -245,10 +245,10 @@ struct    arpcom {
 extern int arpt_keep;                          /* arp resolved cache expire */
 extern int arpt_down;                          /* arp down cache expire */

-extern u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN];
-extern u_int8_t etheranyaddr[ETHER_ADDR_LEN];
-extern u_int8_t ether_ipmulticast_min[ETHER_ADDR_LEN];
-extern u_int8_t ether_ipmulticast_max[ETHER_ADDR_LEN];
+extern const u_int8_t etherbroadcastaddr[ETHER_ADDR_LEN];
+extern const u_int8_t etheranyaddr[ETHER_ADDR_LEN];
+extern const u_int8_t ether_ipmulticast_min[ETHER_ADDR_LEN];
+extern const u_int8_t ether_ipmulticast_max[ETHER_ADDR_LEN];

 #ifdef NFSCLIENT
 extern unsigned int revarp_ifidx;
@@ -284,7 +284,7 @@ struct mbuf *
 int    ether_output(struct ifnet *, struct mbuf *, struct sockaddr *,
            struct rtentry *);
 void   ether_rtrequest(struct ifnet *, int, struct rtentry *);
-char   *ether_sprintf(u_char *);
+char   *ether_sprintf(const u_char *);

 int    ether_brport_isset(struct ifnet *);
 void   ether_brport_set(struct ifnet *, const struct ether_brport *);
Index: netinet/tcp_timer.c
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_timer.c,v
retrieving revision 1.71
diff -u -p -r1.71 tcp_timer.c
--- netinet/tcp_timer.c 7 Nov 2022 11:22:55 -0000       1.71
+++ netinet/tcp_timer.c 14 Dec 2022 15:32:36 -0000
@@ -167,10 +167,10 @@ tcp_canceltimers(struct tcpcb *tp)
                TCP_TIMER_DISARM(tp, i);
 }

-int    tcp_backoff[TCP_MAXRXTSHIFT + 1] =
+const int      tcp_backoff[TCP_MAXRXTSHIFT + 1] =
     { 1, 2, 4, 8, 16, 32, 64, 64, 64, 64, 64, 64, 64 };

-int tcp_totbackoff = 511;      /* sum of tcp_backoff[] */
+const int tcp_totbackoff = 511;        /* sum of tcp_backoff[] */

 /*
  * TCP timer processing.
@@ -376,8 +376,6 @@ tcp_timer_rexmt(void *arg)
 #ifdef TCP_ECN
                tp->snd_last = tp->snd_max;
                tp->t_flags |= TF_SEND_CWR;
-#endif
-#if 1 /* TCP_ECN */
                tcpstat_inc(tcps_cwr_timeout);
 #endif
        }
Index: netinet/tcp_timer.h
===================================================================
RCS file: /cvs/src/sys/netinet/tcp_timer.h,v
retrieving revision 1.19
diff -u -p -r1.19 tcp_timer.h
--- netinet/tcp_timer.h 7 Nov 2022 11:22:55 -0000       1.19
+++ netinet/tcp_timer.h 14 Dec 2022 15:32:36 -0000
@@ -158,7 +158,7 @@ extern int tcp_keepidle;            /* time before
 extern int tcp_keepintvl;              /* time between keepalive probes */
 extern int tcp_maxidle;                        /* time to drop after starting 
probes */
 extern int tcp_ttl;                    /* time to live for TCP segs */
-extern int tcp_backoff[];
+extern const int tcp_backoff[];

 void   tcp_timer_init(void);
 #endif /* _KERNEL */

Reply via email to