* [PATCH libnetfilter_queue] BUG: src: Fix UDP checksum calculation
@ 2019-09-27 12:18 Duncan Roe
2019-09-30 14:28 ` Pablo Neira Ayuso
0 siblings, 1 reply; 3+ messages in thread
From: Duncan Roe @ 2019-09-27 12:18 UTC (permalink / raw)
To: netfilter-devel
The level 4 protocol is part of the UDP and TCP calculations.
nfq_checksum_tcpudp_ipv4() was using IPPROTO_TCP in this calculation,
which gave the wrong answer for UDP.
---
| 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--git a/src/extra/checksum.c b/src/extra/checksum.c
index f367f75..3ef288f 100644
--- a/src/extra/checksum.c
+++ b/src/extra/checksum.c
@@ -46,7 +46,7 @@ uint16_t nfq_checksum_tcpudp_ipv4(struct iphdr *iph)
sum += (iph->saddr) & 0xFFFF;
sum += (iph->daddr >> 16) & 0xFFFF;
sum += (iph->daddr) & 0xFFFF;
- sum += htons(IPPROTO_TCP);
+ sum += htons(iph->protocol);
sum += htons(len);
return nfq_checksum(sum, (uint16_t *)payload, len);
--
2.14.5
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH libnetfilter_queue] BUG: src: Fix UDP checksum calculation
2019-09-27 12:18 [PATCH libnetfilter_queue] BUG: src: Fix UDP checksum calculation Duncan Roe
@ 2019-09-30 14:28 ` Pablo Neira Ayuso
2019-10-01 1:28 ` Duncan Roe
0 siblings, 1 reply; 3+ messages in thread
From: Pablo Neira Ayuso @ 2019-09-30 14:28 UTC (permalink / raw)
To: Duncan Roe; +Cc: netfilter-devel
On Fri, Sep 27, 2019 at 10:18:38PM +1000, Duncan Roe wrote:
> The level 4 protocol is part of the UDP and TCP calculations.
> nfq_checksum_tcpudp_ipv4() was using IPPROTO_TCP in this calculation,
> which gave the wrong answer for UDP.
Thanks Duncan, I sent this patch to fix IPv6 too:
https://patchwork.ozlabs.org/patch/1169407/
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH libnetfilter_queue] BUG: src: Fix UDP checksum calculation
2019-09-30 14:28 ` Pablo Neira Ayuso
@ 2019-10-01 1:28 ` Duncan Roe
0 siblings, 0 replies; 3+ messages in thread
From: Duncan Roe @ 2019-10-01 1:28 UTC (permalink / raw)
To: Pablo Neira Ayuso; +Cc: Netfilter Development
On Mon, Sep 30, 2019 at 04:28:40PM +0200, Pablo Neira Ayuso wrote:
> On Fri, Sep 27, 2019 at 10:18:38PM +1000, Duncan Roe wrote:
> > The level 4 protocol is part of the UDP and TCP calculations.
> > nfq_checksum_tcpudp_ipv4() was using IPPROTO_TCP in this calculation,
> > which gave the wrong answer for UDP.
>
> Thanks Duncan, I sent this patch to fix IPv6 too:
>
> https://patchwork.ozlabs.org/patch/1169407/
>
LGTM
Acked-by: Duncan Roe <duncan_roe@optusnet.com.au>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2019-10-01 1:29 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-27 12:18 [PATCH libnetfilter_queue] BUG: src: Fix UDP checksum calculation Duncan Roe
2019-09-30 14:28 ` Pablo Neira Ayuso
2019-10-01 1:28 ` Duncan Roe
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).