git: da4047d3ba23 - main - fix buildworld after 595d23f777dc.

From: Alexander V. Chernikov <melifaro_at_FreeBSD.org>
Date: Thu, 09 Mar 2023 15:46:11 UTC
The branch main has been updated by melifaro:

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

commit da4047d3ba23201ae4049dccea1151bd6ca2d1df
Author:     Alexander V. Chernikov <melifaro@FreeBSD.org>
AuthorDate: 2023-03-09 15:44:59 +0000
Commit:     Alexander V. Chernikov <melifaro@FreeBSD.org>
CommitDate: 2023-03-09 15:45:57 +0000

    fix buildworld after 595d23f777dc.
    
    Reported by:    se
---
 sys/netlink/netlink_snl.h               | 4 ++--
 sys/netlink/netlink_snl_route.h         | 8 ++++----
 sys/netlink/netlink_snl_route_compat.h  | 3 +++
 sys/netlink/netlink_snl_route_parsers.h | 9 +++++----
 4 files changed, 14 insertions(+), 10 deletions(-)

diff --git a/sys/netlink/netlink_snl.h b/sys/netlink/netlink_snl.h
index 4e6524783310..31b90003b519 100644
--- a/sys/netlink/netlink_snl.h
+++ b/sys/netlink/netlink_snl.h
@@ -677,7 +677,7 @@ snl_add_msg_attr(struct snl_writer *nw, int attr_type, int attr_len, const void
 			return (false);
 	}
 
-        struct nlattr *nla = (struct nlattr *)(&nw->base[nw->offset]);
+        struct nlattr *nla = (struct nlattr *)(void *)(&nw->base[nw->offset]);
 
         nla->nla_len = attr_len + sizeof(struct nlattr);
         nla->nla_type = attr_type;
@@ -838,7 +838,7 @@ snl_finalize_msg(struct snl_writer *nw)
 	return (NULL);
 }
 
-static bool
+static inline bool
 snl_send_msgs(struct snl_writer *nw)
 {
 	int offset = nw->offset;
diff --git a/sys/netlink/netlink_snl_route.h b/sys/netlink/netlink_snl_route.h
index 281794a9d6f7..e67bffde215e 100644
--- a/sys/netlink/netlink_snl_route.h
+++ b/sys/netlink/netlink_snl_route.h
@@ -134,10 +134,10 @@ snl_add_msg_attr_ip(struct snl_writer *nw, int attrtype, const struct sockaddr *
 
 	switch (sa->sa_family) {
 	case AF_INET:
-		addr = &((const struct sockaddr_in *)sa)->sin_addr;
+		addr = &((const struct sockaddr_in *)(const void *)sa)->sin_addr;
 		return (snl_add_msg_attr(nw, attrtype, 4, addr));
 	case AF_INET6:
-		addr = &((const struct sockaddr_in6 *)sa)->sin6_addr;
+		addr = &((const struct sockaddr_in6 *)(const void *)sa)->sin6_addr;
 		return (snl_add_msg_attr(nw, attrtype, 16, addr));
 	}
 
@@ -153,10 +153,10 @@ snl_add_msg_attr_ipvia(struct snl_writer *nw, int attrtype, const struct sockadd
 
 	switch (sa->sa_family) {
 	case AF_INET:
-		memcpy(&buf[1], &((const struct sockaddr_in *)sa)->sin_addr, 4);
+		memcpy(&buf[1], &((const struct sockaddr_in *)(const void *)sa)->sin_addr, 4);
 		return (snl_add_msg_attr(nw, attrtype, 5, buf));
 	case AF_INET6:
-		memcpy(&buf[1], &((const struct sockaddr_in6 *)sa)->sin6_addr, 16);
+		memcpy(&buf[1], &((const struct sockaddr_in6 *)(const void *)sa)->sin6_addr, 16);
 		return (snl_add_msg_attr(nw, attrtype, 17, buf));
 	}
 
diff --git a/sys/netlink/netlink_snl_route_compat.h b/sys/netlink/netlink_snl_route_compat.h
index 51904abb4003..0314c5715e4f 100644
--- a/sys/netlink/netlink_snl_route_compat.h
+++ b/sys/netlink/netlink_snl_route_compat.h
@@ -27,6 +27,9 @@
 #ifndef	_NETLINK_NETLINK_SNL_ROUTE_COMPAT_H_
 #define	_NETLINK_NETLINK_SNL_ROUTE_COMPAT_H_
 
+#include <sys/socket.h>
+#include <sys/types.h>
+
 /*
  * This file contains netlink-compatible definitions from the
  * net/route.h header.
diff --git a/sys/netlink/netlink_snl_route_parsers.h b/sys/netlink/netlink_snl_route_parsers.h
index a76fb7da8ec2..a370f89fb9e3 100644
--- a/sys/netlink/netlink_snl_route_parsers.h
+++ b/sys/netlink/netlink_snl_route_parsers.h
@@ -28,7 +28,7 @@
 #define	_NETLINK_NETLINK_SNL_ROUTE_PARSERS_H_
 
 #include <netlink/netlink_snl.h>
-#include <netlink/netlink_route.h>
+#include <netlink/netlink_snl_route.h>
 
 /* TODO: this file should be generated automatically */
 
@@ -72,7 +72,8 @@ struct rta_mpath {
 };
 
 static bool
-nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, const void *arg, void *target)
+nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, const void *arg __unused,
+    void *target)
 {
 	int data_len = nla->nla_len - sizeof(struct nlattr);
 	struct rtnexthop *rtnh;
@@ -83,7 +84,7 @@ nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, const void *arg,
 	struct rta_mpath *mp = snl_allocz(ss, sz);
 	mp->num_nhops = 0;
 
-	for (rtnh = (struct rtnexthop *)(nla + 1); data_len > 0; ) {
+	for (rtnh = (struct rtnexthop *)(void *)(nla + 1); data_len > 0; ) {
 		struct rta_mpath_nh *mpnh = &mp->nhops[mp->num_nhops++];
 
 		if (!snl_parse_header(ss, rtnh, rtnh->rtnh_len, &_mpath_nh_parser, mpnh))
@@ -91,7 +92,7 @@ nlattr_get_multipath(struct snl_state *ss, struct nlattr *nla, const void *arg,
 
 		int len = NL_ITEM_ALIGN(rtnh->rtnh_len);
 		data_len -= len;
-		rtnh = (struct rtnexthop *)((char *)rtnh + len);
+		rtnh = (struct rtnexthop *)(void *)((char *)rtnh + len);
 	}
 	if (data_len != 0 || mp->num_nhops == 0) {
 		return (false);