[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20201201172442.2d8dca75@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com>
Date: Tue, 1 Dec 2020 17:24:42 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Toke Høiland-Jørgensen <toke@...hat.com>
Cc: "David S. Miller" <davem@...emloft.net>, netdev@...r.kernel.org,
Jonathan Morton <chromatix99@...il.com>,
Pete Heist <pete@...stp.net>
Subject: Re: [PATCH net] inet_ecn: Fix endianness of checksum update when
setting ECT(1)
On Mon, 30 Nov 2020 19:37:05 +0100 Toke Høiland-Jørgensen wrote:
> When adding support for propagating ECT(1) marking in IP headers it seems I
> suffered from endianness-confusion in the checksum update calculation: In
> fact the ECN field is in the *lower* bits of the first 16-bit word of the
> IP header when calculating in network byte order. This means that the
> addition performed to update the checksum field was wrong; let's fix that.
>
> Fixes: b723748750ec ("tunnel: Propagate ECT(1) when decapsulating as recommended by RFC6040")
> Reported-by: Jonathan Morton <chromatix99@...il.com>
> Tested-by: Pete Heist <pete@...stp.net>
> Signed-off-by: Toke Høiland-Jørgensen <toke@...hat.com>
Applied and queued, thanks!
> diff --git a/include/net/inet_ecn.h b/include/net/inet_ecn.h
> index e1eaf1780288..563457fec557 100644
> --- a/include/net/inet_ecn.h
> +++ b/include/net/inet_ecn.h
> @@ -107,7 +107,7 @@ static inline int IP_ECN_set_ect1(struct iphdr *iph)
> if ((iph->tos & INET_ECN_MASK) != INET_ECN_ECT_0)
> return 0;
>
> - check += (__force u16)htons(0x100);
> + check += (__force u16)htons(0x1);
>
> iph->check = (__force __sum16)(check + (check>=0xFFFF));
> iph->tos ^= INET_ECN_MASK;
This seems to be open coding csum16_add() - is there a reason and if
not perhaps worth following up in net-next?
Powered by blists - more mailing lists