libnetlink.h: Include <endian.h> explicitly for musl
Subsystems (2)
PATCH 1/1 libnetlink.h: Include <endian.h> explicitly for musl
The code added in 976dca372 uses h2be64, defined in endian.h. While this is pulled in around some corners for glibc (see below), that's not the case for musl and an explicit include is required.
. /usr/include/libmnl/libmnl.h
.. /usr/include/sys/socket.h
... /usr/include/bits/socket.h
.... /usr/include/sys/types.h
..... /usr/include/endian.h
---
This time also to the netdev list, sorry...
--- include/libnetlink.h | 1 + 1 file changed, 1 insertion(+)
include/libnetlink.h +1 -0
@@ -4,6 +4,7 @@#include <stdio.h> #include <string.h> +#include <endian.h> #include <asm/types.h> #include <linux/netlink.h> #include <linux/rtnetlink.h>
Signature · 1 line
2.44.2
Quoted 11 lines · On Sun, 4 Aug 2024 16:57:46 +0200 Andreas K. Hüttel <[email protected]>…
The code added in
976dca372uses h2be64, defined inendian.h. While this is pulled in around some corners for glibc (see below), that's not the case for musl and an explicit include is required..
/usr/include/libmnl/libmnl.h
../usr/include/sys/socket.h
.../usr/include/bits/socket.h
..../usr/include/sys/types.h
...../usr/include/endian.h
Quoted 3 lines
Signed-off-by Andreas K. Hüttel <[email protected]>---
The commit message needs to be reworded. Should use fixes tag than a specific commit hash value.
PATCH v2 1/1 libnetlink.h: Include <endian.h> explicitly for musl
The code added in "f_flower: implement pfcp opts" uses h2be64, defined in endian.h. While this is pulled in around some corners for glibc (see below), that's not the case for musl and an explicit include is required there.
. /usr/include/libmnl/libmnl.h
.. /usr/include/sys/socket.h
... /usr/include/bits/socket.h
.... /usr/include/sys/types.h
..... /usr/include/endian.h
--- include/libnetlink.h | 1 + 1 file changed, 1 insertion(+)
include/libnetlink.h +1 -0
@@ -4,6 +4,7 @@#include <stdio.h> #include <string.h> +#include <endian.h> #include <asm/types.h> #include <linux/netlink.h> #include <linux/rtnetlink.h>
Signature · 1 line
2.44.2
Quoted 11 lines · On Sun, 4 Aug 2024 18:03:23 +0200 Andreas K. Hüttel <[email protected]>…
The code added in "
f_flower: implement pfcp opts" uses h2be64, defined inendian.h. While this is pulled in around some corners for glibc (see below), that's not the case for musl and an explicit include is required there..
/usr/include/libmnl/libmnl.h
../usr/include/sys/socket.h
.../usr/include/bits/socket.h
..../usr/include/sys/types.h
...../usr/include/endian.h
Quoted 3 lines
Fixes 976dca372 ("f_flower: implement pfcp opts")Signed-off-by Andreas K. Hüttel <[email protected]>
Other parts of flower code use htonll().
It would have been better to be consistent and not use h2be64() at all.
Quoted 15 lines · Stephen Hemminger
Quoted 11 lines · On Sun, 4 Aug 2024 18:03:23 +0200 Andreas K. Hüttel <[email protected]>…
The code added in "
f_flower: implement pfcp opts" uses h2be64, defined inendian.h. While this is pulled in around some corners for glibc (see below), that's not the case for musl and an explicit include is required there..
/usr/include/libmnl/libmnl.h
../usr/include/sys/socket.h
.../usr/include/bits/socket.h
..../usr/include/sys/types.h
...../usr/include/endian.h
Quoted 6 lines
Quoted 3 lines
Fixes 976dca372 ("f_flower: implement pfcp opts")Signed-off-by Andreas K. Hüttel <[email protected]>Other parts of flower code use
htonll().
It would have been better to be consistent and not useh2be64()at all.
htonl is used for 32-bit numbers. It won't work properly with 64-bit numbers.
Quoted 18 lines · Mike Gilbert
Quoted 15 lines · Stephen Hemminger
Quoted 11 lines · On Sun, 4 Aug 2024 18:03:23 +0200 Andreas K. Hüttel <[email protected]>…
The code added in "
f_flower: implement pfcp opts" uses h2be64, defined inendian.h. While this is pulled in around some corners for glibc (see below), that's not the case for musl and an explicit include is required there..
/usr/include/libmnl/libmnl.h
../usr/include/sys/socket.h
.../usr/include/bits/socket.h
..../usr/include/sys/types.h
...../usr/include/endian.h
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
Fixes 976dca372 ("f_flower: implement pfcp opts")Signed-off-by Andreas K. Hüttel <[email protected]>Other parts of flower code use
htonll().
It would have been better to be consistent and not useh2be64()at all.htonl is used for 32-bit numbers. It won't work properly with 64-bit numbers.
Sorry, I missed the second "l".