Message ID | 20240804160355.940167-1-dilfridge@gentoo.org (mailing list archive) |
---|---|
State | New, archived |
Delegated to: | Stephen Hemminger |
Headers | show |
Series | [v2,iproute2] libnetlink.h: Include <endian.h> explicitly for musl | expand |
Context | Check | Description |
---|---|---|
netdev/tree_selection | success | Not a local patch |
On Sun, 4 Aug 2024 18:03:23 +0200 Andreas K. Hüttel <dilfridge@gentoo.org> wrote: > 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 > > Fixes: 976dca372 ("f_flower: implement pfcp opts") > Bug: https://bugs.gentoo.org/936234 > Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> Other parts of flower code use htonll(). It would have been better to be consistent and not use h2be64() at all.
On Sun, Aug 4, 2024 at 12:58 PM Stephen Hemminger <stephen@networkplumber.org> wrote: > > On Sun, 4 Aug 2024 18:03:23 +0200 > Andreas K. Hüttel <dilfridge@gentoo.org> wrote: > > > 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 > > > > Fixes: 976dca372 ("f_flower: implement pfcp opts") > > Bug: https://bugs.gentoo.org/936234 > > Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> > > Other parts of flower code use htonll(). > It would have been better to be consistent and not use h2be64() at all. htonl is used for 32-bit numbers. It won't work properly with 64-bit numbers.
On Sun, Aug 4, 2024 at 1:07 PM Mike Gilbert <floppym@gentoo.org> wrote: > > On Sun, Aug 4, 2024 at 12:58 PM Stephen Hemminger > <stephen@networkplumber.org> wrote: > > > > On Sun, 4 Aug 2024 18:03:23 +0200 > > Andreas K. Hüttel <dilfridge@gentoo.org> wrote: > > > > > 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 > > > > > > Fixes: 976dca372 ("f_flower: implement pfcp opts") > > > Bug: https://bugs.gentoo.org/936234 > > > Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> > > > > Other parts of flower code use htonll(). > > It would have been better to be consistent and not use h2be64() at all. > > htonl is used for 32-bit numbers. It won't work properly with 64-bit numbers. Sorry, I missed the second "l".
diff --git a/include/libnetlink.h b/include/libnetlink.h index 30f0c2d2..7074e913 100644 --- a/include/libnetlink.h +++ b/include/libnetlink.h @@ -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>
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 Fixes: 976dca372 ("f_flower: implement pfcp opts") Bug: https://bugs.gentoo.org/936234 Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org> --- include/libnetlink.h | 1 + 1 file changed, 1 insertion(+)