netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: David Miller <davem@davemloft.net>
To: gnault@redhat.com
Cc: kuba@kernel.org, netdev@vger.kernel.org
Subject: Re: [PATCH net] ipv4: Ignore ECN bits for fib lookups in fib_compute_spec_dst()
Date: Mon, 28 Dec 2020 14:45:22 -0800 (PST)	[thread overview]
Message-ID: <20201228.144522.2164224163258675861.davem@davemloft.net> (raw)
In-Reply-To: <49ff39b1f55c914847cd58678bae6282112db701.1608836260.git.gnault@redhat.com>

From: Guillaume Nault <gnault@redhat.com>
Date: Thu, 24 Dec 2020 20:01:09 +0100

> RT_TOS() only clears one of the ECN bits. Therefore, when
> fib_compute_spec_dst() resorts to a fib lookup, it can return
> different results depending on the value of the second ECN bit.
> 
> For example, ECT(0) and ECT(1) packets could be treated differently.
> 
>   $ ip netns add ns0
>   $ ip netns add ns1
>   $ ip link add name veth01 netns ns0 type veth peer name veth10 netns ns1
>   $ ip -netns ns0 link set dev lo up
>   $ ip -netns ns1 link set dev lo up
>   $ ip -netns ns0 link set dev veth01 up
>   $ ip -netns ns1 link set dev veth10 up
> 
>   $ ip -netns ns0 address add 192.0.2.10/24 dev veth01
>   $ ip -netns ns1 address add 192.0.2.11/24 dev veth10
> 
>   $ ip -netns ns1 address add 192.0.2.21/32 dev lo
>   $ ip -netns ns1 route add 192.0.2.10/32 tos 4 dev veth10 src 192.0.2.21
>   $ ip netns exec ns1 sysctl -wq net.ipv4.icmp_echo_ignore_broadcasts=0
> 
> With TOS 4 and ECT(1), ns1 replies using source address 192.0.2.21
> (ping uses -Q to set all TOS and ECN bits):
> 
>   $ ip netns exec ns0 ping -c 1 -b -Q 5 192.0.2.255
>   [...]
>   64 bytes from 192.0.2.21: icmp_seq=1 ttl=64 time=0.544 ms
> 
> But with TOS 4 and ECT(0), ns1 replies using source address 192.0.2.11
> because the "tos 4" route isn't matched:
> 
>   $ ip netns exec ns0 ping -c 1 -b -Q 6 192.0.2.255
>   [...]
>   64 bytes from 192.0.2.11: icmp_seq=1 ttl=64 time=0.597 ms
> 
> After this patch the ECN bits don't affect the result anymore:
> 
>   $ ip netns exec ns0 ping -c 1 -b -Q 6 192.0.2.255
>   [...]
>   64 bytes from 192.0.2.21: icmp_seq=1 ttl=64 time=0.591 ms
> 
> Fixes: 35ebf65e851c ("ipv4: Create and use fib_compute_spec_dst() helper.")
> Signed-off-by: Guillaume Nault <gnault@redhat.com>

Applied and queued up for -stable, thanks.


      reply	other threads:[~2020-12-28 23:15 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-12-24 19:01 [PATCH net] ipv4: Ignore ECN bits for fib lookups in fib_compute_spec_dst() Guillaume Nault
2020-12-28 22:45 ` David Miller [this message]

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=20201228.144522.2164224163258675861.davem@davemloft.net \
    --to=davem@davemloft.net \
    --cc=gnault@redhat.com \
    --cc=kuba@kernel.org \
    --cc=netdev@vger.kernel.org \
    /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 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).