git: 700a395c581c - main - tcp_log_vain/addrs: Use a const pointer for the IPv4 header.

From: John Baldwin <jhb_at_FreeBSD.org>
Date: Wed, 13 Apr 2022 23:09:40 UTC
The branch main has been updated by jhb:

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

commit 700a395c581c43d77cc827b9fb326ece629bf4c1
Author:     John Baldwin <jhb@FreeBSD.org>
AuthorDate: 2022-04-13 23:08:21 +0000
Commit:     John Baldwin <jhb@FreeBSD.org>
CommitDate: 2022-04-13 23:08:21 +0000

    tcp_log_vain/addrs: Use a const pointer for the IPv4 header.
    
    The pointer to the IPv6 header was already const.
---
 sys/netinet/tcp_subr.c | 10 +++++-----
 sys/netinet/tcp_var.h  |  4 ++--
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/sys/netinet/tcp_subr.c b/sys/netinet/tcp_subr.c
index 189e2cf26fa6..3b02cd6d1945 100644
--- a/sys/netinet/tcp_subr.c
+++ b/sys/netinet/tcp_subr.c
@@ -377,7 +377,7 @@ static struct inpcb *tcp_notify(struct inpcb *, int);
 static struct inpcb *tcp_mtudisc_notify(struct inpcb *, int);
 static struct inpcb *tcp_mtudisc(struct inpcb *, int);
 static char *	tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th,
-		    void *ip4hdr, const void *ip6hdr);
+		    const void *ip4hdr, const void *ip6hdr);
 
 static struct tcp_function_block tcp_def_funcblk = {
 	.tfb_tcp_block_name = "freebsd",
@@ -3888,7 +3888,7 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, switch_to_ifnet_tls,
  * and ip6_hdr pointers have to be passed as void pointers.
  */
 char *
-tcp_log_vain(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
+tcp_log_vain(struct in_conninfo *inc, struct tcphdr *th, const void *ip4hdr,
     const void *ip6hdr)
 {
 
@@ -3900,7 +3900,7 @@ tcp_log_vain(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
 }
 
 char *
-tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
+tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, const void *ip4hdr,
     const void *ip6hdr)
 {
 
@@ -3912,13 +3912,13 @@ tcp_log_addrs(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
 }
 
 static char *
-tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th, void *ip4hdr,
+tcp_log_addr(struct in_conninfo *inc, struct tcphdr *th, const void *ip4hdr,
     const void *ip6hdr)
 {
 	char *s, *sp;
 	size_t size;
 #ifdef INET
-	struct ip *ip = (struct ip *)ip4hdr;
+	const struct ip *ip = (const struct ip *)ip4hdr;
 #endif
 #ifdef INET6
 	const struct ip6_hdr *ip6 = (const struct ip6_hdr *)ip6hdr;
diff --git a/sys/netinet/tcp_var.h b/sys/netinet/tcp_var.h
index b9d37471771c..be9ff06f3a85 100644
--- a/sys/netinet/tcp_var.h
+++ b/sys/netinet/tcp_var.h
@@ -1087,9 +1087,9 @@ int	 tcp_ctloutput(struct socket *, struct sockopt *);
 void 	 tcp_ctlinput_viaudp(int, struct sockaddr *, void *, void *);
 void	 tcp_drain(void);
 void	 tcp_fini(void *);
-char	*tcp_log_addrs(struct in_conninfo *, struct tcphdr *, void *,
+char	*tcp_log_addrs(struct in_conninfo *, struct tcphdr *, const void *,
 	    const void *);
-char	*tcp_log_vain(struct in_conninfo *, struct tcphdr *, void *,
+char	*tcp_log_vain(struct in_conninfo *, struct tcphdr *, const void *,
 	    const void *);
 int	 tcp_reass(struct tcpcb *, struct tcphdr *, tcp_seq *, int *,
 	    struct mbuf *);