* [PATCH v2] tcp: Fix build against musl, __sum16 comes from linux/types.h
@ 2024-10-31 7:14 Stefano Brivio
2024-11-02 3:29 ` David Gibson
0 siblings, 1 reply; 2+ messages in thread
From: Stefano Brivio @ 2024-10-31 7:14 UTC (permalink / raw)
To: passt-dev; +Cc: Laurent Vivier, David Gibson, omni
Use a plain uint16_t instead and avoid including one extra header:
the 'bitwise' attribute of __sum16 is just used by sparse(1).
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>
---
v2: Use uint16_t instead of including linux/types.h
tcp.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tcp.c b/tcp.c
index 4e0a17e..56ceba6 100644
--- a/tcp.c
+++ b/tcp.c
@@ -766,7 +766,7 @@ static void tcp_update_check_tcp4(const struct iphdr *iph,
struct in_addr saddr = { .s_addr = iph->saddr };
struct in_addr daddr = { .s_addr = iph->daddr };
size_t check_ofs;
- __sum16 *check;
+ uint16_t *check;
int check_idx;
uint32_t sum;
char *ptr;
@@ -797,7 +797,7 @@ static void tcp_update_check_tcp4(const struct iphdr *iph,
return;
}
- check = (__sum16 *)ptr;
+ check = (uint16_t *)ptr;
*check = 0;
*check = csum_iov(iov, iov_cnt, l4offset, sum);
@@ -816,7 +816,7 @@ static void tcp_update_check_tcp6(const struct ipv6hdr *ip6h,
{
uint16_t l4len = ntohs(ip6h->payload_len);
size_t check_ofs;
- __sum16 *check;
+ uint16_t *check;
int check_idx;
uint32_t sum;
char *ptr;
@@ -848,7 +848,7 @@ static void tcp_update_check_tcp6(const struct ipv6hdr *ip6h,
return;
}
- check = (__sum16 *)ptr;
+ check = (uint16_t *)ptr;
*check = 0;
*check = csum_iov(iov, iov_cnt, l4offset, sum);
--
@@ -766,7 +766,7 @@ static void tcp_update_check_tcp4(const struct iphdr *iph,
struct in_addr saddr = { .s_addr = iph->saddr };
struct in_addr daddr = { .s_addr = iph->daddr };
size_t check_ofs;
- __sum16 *check;
+ uint16_t *check;
int check_idx;
uint32_t sum;
char *ptr;
@@ -797,7 +797,7 @@ static void tcp_update_check_tcp4(const struct iphdr *iph,
return;
}
- check = (__sum16 *)ptr;
+ check = (uint16_t *)ptr;
*check = 0;
*check = csum_iov(iov, iov_cnt, l4offset, sum);
@@ -816,7 +816,7 @@ static void tcp_update_check_tcp6(const struct ipv6hdr *ip6h,
{
uint16_t l4len = ntohs(ip6h->payload_len);
size_t check_ofs;
- __sum16 *check;
+ uint16_t *check;
int check_idx;
uint32_t sum;
char *ptr;
@@ -848,7 +848,7 @@ static void tcp_update_check_tcp6(const struct ipv6hdr *ip6h,
return;
}
- check = (__sum16 *)ptr;
+ check = (uint16_t *)ptr;
*check = 0;
*check = csum_iov(iov, iov_cnt, l4offset, sum);
--
2.43.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] tcp: Fix build against musl, __sum16 comes from linux/types.h
2024-10-31 7:14 [PATCH v2] tcp: Fix build against musl, __sum16 comes from linux/types.h Stefano Brivio
@ 2024-11-02 3:29 ` David Gibson
0 siblings, 0 replies; 2+ messages in thread
From: David Gibson @ 2024-11-02 3:29 UTC (permalink / raw)
To: Stefano Brivio; +Cc: passt-dev, Laurent Vivier, omni
[-- Attachment #1: Type: text/plain, Size: 1930 bytes --]
On Thu, Oct 31, 2024 at 08:14:32AM +0100, Stefano Brivio wrote:
> Use a plain uint16_t instead and avoid including one extra header:
> the 'bitwise' attribute of __sum16 is just used by sparse(1).
>
> 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>
Reviewed-by: David Gibson <david@gibson.dropbear.id.au>
> ---
> v2: Use uint16_t instead of including linux/types.h
>
> tcp.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/tcp.c b/tcp.c
> index 4e0a17e..56ceba6 100644
> --- a/tcp.c
> +++ b/tcp.c
> @@ -766,7 +766,7 @@ static void tcp_update_check_tcp4(const struct iphdr *iph,
> struct in_addr saddr = { .s_addr = iph->saddr };
> struct in_addr daddr = { .s_addr = iph->daddr };
> size_t check_ofs;
> - __sum16 *check;
> + uint16_t *check;
> int check_idx;
> uint32_t sum;
> char *ptr;
> @@ -797,7 +797,7 @@ static void tcp_update_check_tcp4(const struct iphdr *iph,
> return;
> }
>
> - check = (__sum16 *)ptr;
> + check = (uint16_t *)ptr;
>
> *check = 0;
> *check = csum_iov(iov, iov_cnt, l4offset, sum);
> @@ -816,7 +816,7 @@ static void tcp_update_check_tcp6(const struct ipv6hdr *ip6h,
> {
> uint16_t l4len = ntohs(ip6h->payload_len);
> size_t check_ofs;
> - __sum16 *check;
> + uint16_t *check;
> int check_idx;
> uint32_t sum;
> char *ptr;
> @@ -848,7 +848,7 @@ static void tcp_update_check_tcp6(const struct ipv6hdr *ip6h,
> return;
> }
>
> - check = (__sum16 *)ptr;
> + check = (uint16_t *)ptr;
>
> *check = 0;
> *check = csum_iov(iov, iov_cnt, l4offset, sum);
--
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] 2+ messages in thread
end of thread, other threads:[~2024-11-02 3:31 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-31 7:14 [PATCH v2] tcp: Fix build against musl, __sum16 comes from linux/types.h Stefano Brivio
2024-11-02 3:29 ` David Gibson
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).