Skip to contentSkip to conversation

libnetlink.h: Add <endian.h> for htobe64

PATCH In review Haelwenn (lanodan) Monnier 2 participants 3 messages Jul 12, 2024 – Nov 26, 2024

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 libnetlink.h: Add <endian.h> for htobe64

Required to build on musl (1.2.5)

---
 include/libnetlink.h | 1 +
 1 file changed, 1 insertion(+)
include/libnetlink.h +1 -0
index 30f0c2d..2b207e8 100644
@@ -3,6 +3,7 @@
 #define __LIBNETLINK_H__ 1
 
 #include <stdio.h>
+#include <endian.h>
 #include <string.h>
 #include <asm/types.h>
 #include <linux/netlink.h>
Signature · 1 line
2.44.2
#1 lore raw

PATCH 2/2 arpd.c: Use names for struct msghdr initialisation

Fixes the following compiler error which is due to padding elements being present in musl (1.2.5), thankfully the struct element names are part of POSIX.

arpd.c:442:3: error: incompatible pointer to integer conversion initializing 'int' with an expression of type 'void *' [-Wint-conversion]

  442 |                 NULL,   0,
      |                 ^~~~
---
 misc/arpd.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)
misc/arpd.c +7 -4
index 3185620..724d387 100644
@@ -437,10 +437,13 @@ static void get_kern_msg(void)
 	struct iovec iov;
 	char   buf[8192];
 	struct msghdr msg = {
-		(void *)&nladdr, sizeof(nladdr),
-		&iov,	1,
-		NULL,	0,
-		0
+		.msg_name = (void *)&nladdr,
+		.msg_namelen = sizeof(nladdr),
+		.msg_iov = &iov,
+		.msg_iovlen = 1,
+		.msg_control = NULL,
+		.msg_controllen = 0,
+		.msg_flags = 0
 	};
 
 	iov.iov_base = buf;
Signature · 1 line
2.44.2
Reviewed-by on v1 1/2
#2 lore raw
In reply to Haelwenn (lanodan) Monnier
Quoted 6 lines · Haelwenn (lanodan) Monnier

Required to build on musl (1.2.5)

---
 include/libnetlink.h | 1 +
 1 file changed, 1 insertion(+)
Quoted 15 lines
include/libnetlink.h +1 -1
index 30f0c2d..2b207e8 100644
@@ -3,6 +3,7 @@
 #define __LIBNETLINK_H__ 1
 
 #include <stdio.h>
+#include <endian.h>
 #include <string.h>
 #include <asm/types.h>
 #include <linux/netlink.h>
--

2.44.2