* [PATCH] tcp: Fix build against musl, __sum16 comes from linux/types.h
@ 2024-10-30 20:50 Stefano Brivio
2024-10-31 0:34 ` David Gibson
0 siblings, 1 reply; 3+ messages in thread
From: Stefano Brivio @ 2024-10-30 20:50 UTC (permalink / raw)
To: passt-dev; +Cc: Laurent Vivier, David Gibson, omni
...so we need to include that header explicitly. For some reason, it
works without it when building against glibc.
Reported-by: omni <omni+alpine@hack.org>
Fixes: 3d484aa37090 ("tcp: Update TCP checksum using an iovec array")
Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
---
tcp.c | 2 ++
1 file changed, 2 insertions(+)
diff --git a/tcp.c b/tcp.c
index 4e0a17e..429634a 100644
--- a/tcp.c
+++ b/tcp.c
@@ -287,6 +287,8 @@
#include <time.h>
#include <arpa/inet.h>
+#include <linux/types.h> /* For __sum16 */
+
#include "checksum.h"
#include "util.h"
#include "iov.h"
--
@@ -287,6 +287,8 @@
#include <time.h>
#include <arpa/inet.h>
+#include <linux/types.h> /* For __sum16 */
+
#include "checksum.h"
#include "util.h"
#include "iov.h"
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] tcp: Fix build against musl, __sum16 comes from linux/types.h
2024-10-30 20:50 [PATCH] tcp: Fix build against musl, __sum16 comes from linux/types.h Stefano Brivio
@ 2024-10-31 0:34 ` David Gibson
2024-10-31 6:56 ` Stefano Brivio
0 siblings, 1 reply; 3+ messages in thread
From: David Gibson @ 2024-10-31 0:34 UTC (permalink / raw)
To: Stefano Brivio; +Cc: passt-dev, Laurent Vivier, omni
[-- Attachment #1: Type: text/plain, Size: 1301 bytes --]
On Wed, Oct 30, 2024 at 09:50:10PM +0100, Stefano Brivio wrote:
> ...so we need to include that header explicitly. For some reason, it
> works without it when building against glibc.
Presumably because glibc indirectly imports linux/types.h at some
point.
But, I think there's a better way to fix this. We use __sum16 because
it's the type of the checksum field in the linux/tcp.h version of
struct tcphdr. But we've recently changed to using the netinet/tcp.h
version, which just uses a plain uint16_t. We should change to match,
and this will go away.
>
> Reported-by: omni <omni+alpine@hack.org>
> Fixes: 3d484aa37090 ("tcp: Update TCP checksum using an iovec array")
> Signed-off-by: Stefano Brivio <sbrivio@redhat.com>
> ---
> tcp.c | 2 ++
> 1 file changed, 2 insertions(+)
>
> diff --git a/tcp.c b/tcp.c
> index 4e0a17e..429634a 100644
> --- a/tcp.c
> +++ b/tcp.c
> @@ -287,6 +287,8 @@
> #include <time.h>
> #include <arpa/inet.h>
>
> +#include <linux/types.h> /* For __sum16 */
> +
> #include "checksum.h"
> #include "util.h"
> #include "iov.h"
--
David Gibson (he or they) | I'll have my music baroque, and my code
david AT gibson.dropbear.id.au | minimalist, thank you, not the other way
| around.
http://www.ozlabs.org/~dgibson
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] tcp: Fix build against musl, __sum16 comes from linux/types.h
2024-10-31 0:34 ` David Gibson
@ 2024-10-31 6:56 ` Stefano Brivio
0 siblings, 0 replies; 3+ messages in thread
From: Stefano Brivio @ 2024-10-31 6:56 UTC (permalink / raw)
To: David Gibson; +Cc: passt-dev, Laurent Vivier, omni
On Thu, 31 Oct 2024 11:34:38 +1100
David Gibson <david@gibson.dropbear.id.au> wrote:
> On Wed, Oct 30, 2024 at 09:50:10PM +0100, Stefano Brivio wrote:
> > ...so we need to include that header explicitly. For some reason, it
> > works without it when building against glibc.
>
> Presumably because glibc indirectly imports linux/types.h at some
> point.
>
> But, I think there's a better way to fix this. We use __sum16 because
> it's the type of the checksum field in the linux/tcp.h version of
> struct tcphdr. But we've recently changed to using the netinet/tcp.h
> version, which just uses a plain uint16_t. We should change to match,
> and this will go away.
True, but I thought we would want to keep the 'bitwise' attribute that
comes with __sum16. On the other hand, I see it's only used by
sparse(1), not by gcc itself:
https://gcc.gnu.org/legacy-ml/gcc-help/2008-03/msg00267.html
so it's rather pointless outside the kernel and we can drop it as well.
I'll change checksum pointers to uint16_t *.
--
Stefano
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-10-31 6:56 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-30 20:50 [PATCH] tcp: Fix build against musl, __sum16 comes from linux/types.h Stefano Brivio
2024-10-31 0:34 ` David Gibson
2024-10-31 6:56 ` Stefano Brivio
Code repositories for project(s) associated with this public inbox
https://passt.top/passt
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 IMAP folder(s).