netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH iproute2] libnetlink.h: Include <endian.h> explicitly for musl
@ 2024-08-04 14:57 Andreas K. Hüttel
  2024-08-04 15:55 ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas K. Hüttel @ 2024-08-04 14:57 UTC (permalink / raw)
  To: stephen, netdev; +Cc: base-system, Andreas K. Hüttel

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

Bug: https://bugs.gentoo.org/936234
Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
---
This time also to the netdev list, sorry...
---
 include/libnetlink.h | 1 +
 1 file changed, 1 insertion(+)

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>
-- 
2.44.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH iproute2] libnetlink.h: Include <endian.h> explicitly for musl
  2024-08-04 14:57 [PATCH iproute2] libnetlink.h: Include <endian.h> explicitly for musl Andreas K. Hüttel
@ 2024-08-04 15:55 ` Stephen Hemminger
  2024-08-04 16:03   ` [PATCH v2 " Andreas K. Hüttel
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2024-08-04 15:55 UTC (permalink / raw)
  To: Andreas K. Hüttel; +Cc: netdev, base-system

On Sun,  4 Aug 2024 16:57:46 +0200
Andreas K. Hüttel <dilfridge@gentoo.org> wrote:

> 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
> 
> Bug: https://bugs.gentoo.org/936234
> Signed-off-by: Andreas K. Hüttel <dilfridge@gentoo.org>
> ---

The commit message needs to be reworded.
Should use fixes tag than a specific commit hash value.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* [PATCH v2 iproute2] libnetlink.h: Include <endian.h> explicitly for musl
  2024-08-04 15:55 ` Stephen Hemminger
@ 2024-08-04 16:03   ` Andreas K. Hüttel
  2024-08-04 16:58     ` Stephen Hemminger
  0 siblings, 1 reply; 6+ messages in thread
From: Andreas K. Hüttel @ 2024-08-04 16:03 UTC (permalink / raw)
  To: netdev; +Cc: stephen, base-system, Andreas K. Hüttel

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(+)

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>
-- 
2.44.2


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 iproute2] libnetlink.h: Include <endian.h> explicitly for musl
  2024-08-04 16:03   ` [PATCH v2 " Andreas K. Hüttel
@ 2024-08-04 16:58     ` Stephen Hemminger
  2024-08-04 17:07       ` Mike Gilbert
  0 siblings, 1 reply; 6+ messages in thread
From: Stephen Hemminger @ 2024-08-04 16:58 UTC (permalink / raw)
  To: Andreas K. Hüttel; +Cc: netdev, base-system

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 iproute2] libnetlink.h: Include <endian.h> explicitly for musl
  2024-08-04 16:58     ` Stephen Hemminger
@ 2024-08-04 17:07       ` Mike Gilbert
  2024-08-04 17:09         ` Mike Gilbert
  0 siblings, 1 reply; 6+ messages in thread
From: Mike Gilbert @ 2024-08-04 17:07 UTC (permalink / raw)
  To: Stephen Hemminger; +Cc: Andreas K. Hüttel, netdev, base-system

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH v2 iproute2] libnetlink.h: Include <endian.h> explicitly for musl
  2024-08-04 17:07       ` Mike Gilbert
@ 2024-08-04 17:09         ` Mike Gilbert
  0 siblings, 0 replies; 6+ messages in thread
From: Mike Gilbert @ 2024-08-04 17:09 UTC (permalink / raw)
  To: Mike Gilbert
  Cc: Stephen Hemminger, Andreas K. Hüttel, netdev, base-system

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".

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-08-04 17:09 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-08-04 14:57 [PATCH iproute2] libnetlink.h: Include <endian.h> explicitly for musl Andreas K. Hüttel
2024-08-04 15:55 ` Stephen Hemminger
2024-08-04 16:03   ` [PATCH v2 " Andreas K. Hüttel
2024-08-04 16:58     ` Stephen Hemminger
2024-08-04 17:07       ` Mike Gilbert
2024-08-04 17:09         ` Mike Gilbert

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).