All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: "Toke Høiland-Jørgensen" <toke@redhat.com>
Cc: "David S. Miller" <davem@davemloft.net>,
	netdev@vger.kernel.org, Jonathan Morton <chromatix99@gmail.com>,
	Pete Heist <pete@heistp.net>
Subject: Re: [PATCH net] inet_ecn: Fix endianness of checksum update when setting ECT(1)
Date: Tue, 1 Dec 2020 17:24:42 -0800	[thread overview]
Message-ID: <20201201172442.2d8dca75@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> (raw)
In-Reply-To: <20201130183705.17540-1-toke@redhat.com>

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@gmail.com>
> Tested-by: Pete Heist <pete@heistp.net>
> Signed-off-by: Toke Høiland-Jørgensen <toke@redhat.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?

  reply	other threads:[~2020-12-02  1:25 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-30 18:37 [PATCH net] inet_ecn: Fix endianness of checksum update when setting ECT(1) Toke Høiland-Jørgensen
2020-12-02  1:24 ` Jakub Kicinski [this message]
2020-12-02 10:07   ` Toke Høiland-Jørgensen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20201201172442.2d8dca75@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=chromatix99@gmail.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    --cc=pete@heistp.net \
    --cc=toke@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.