All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jakub Kicinski <kuba@kernel.org>
To: David Ahern <dsahern@gmail.com>
Cc: Guillaume Nault <gnault@redhat.com>,
	David Miller <davem@davemloft.net>,
	netdev@vger.kernel.org, Russell Strong <russell@strong.id.au>
Subject: Re: [PATCH net] ipv4: Fix tos mask in inet_rtm_getroute()
Date: Sat, 28 Nov 2020 13:17:16 -0800	[thread overview]
Message-ID: <20201128131716.783ff3dd@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com> (raw)
In-Reply-To: <ace2daed-7d88-7364-5395-80b63f59ffc1@gmail.com>

On Sat, 28 Nov 2020 10:03:42 -0700 David Ahern wrote:
> On 11/26/20 11:09 AM, Guillaume Nault wrote:
> > When inet_rtm_getroute() was converted to use the RCU variants of
> > ip_route_input() and ip_route_output_key(), the TOS parameters
> > stopped being masked with IPTOS_RT_MASK before doing the route lookup.
> > 
> > As a result, "ip route get" can return a different route than what
> > would be used when sending real packets.
> > 
> > For example:
> > 
> >     $ ip route add 192.0.2.11/32 dev eth0
> >     $ ip route add unreachable 192.0.2.11/32 tos 2
> >     $ ip route get 192.0.2.11 tos 2
> >     RTNETLINK answers: No route to host
> > 
> > But, packets with TOS 2 (ECT(0) if interpreted as an ECN bit) would
> > actually be routed using the first route:
> > 
> >     $ ping -c 1 -Q 2 192.0.2.11
> >     PING 192.0.2.11 (192.0.2.11) 56(84) bytes of data.
> >     64 bytes from 192.0.2.11: icmp_seq=1 ttl=64 time=0.173 ms
> > 
> >     --- 192.0.2.11 ping statistics ---
> >     1 packets transmitted, 1 received, 0% packet loss, time 0ms
> >     rtt min/avg/max/mdev = 0.173/0.173/0.173/0.000 ms
> > 
> > This patch re-applies IPTOS_RT_MASK in inet_rtm_getroute(), to
> > return results consistent with real route lookups.
> > 
> > Fixes: 3765d35ed8b9 ("net: ipv4: Convert inet_rtm_getroute to rcu versions of route lookup")
> > Signed-off-by: Guillaume Nault <gnault@redhat.com>
> 
> Reviewed-by: David Ahern <dsahern@kernel.org>

Applied, thanks!

Should the discrepancy between the behavior of ip_route_input_rcu() and
ip_route_input() be addressed, possibly? 

  reply	other threads:[~2020-11-28 22:12 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-11-26 18:09 [PATCH net] ipv4: Fix tos mask in inet_rtm_getroute() Guillaume Nault
2020-11-28 17:03 ` David Ahern
2020-11-28 21:17   ` Jakub Kicinski [this message]
2020-11-29 12:54     ` Guillaume Nault
2020-11-30 16:51       ` Jakub Kicinski

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=20201128131716.783ff3dd@kicinski-fedora-pc1c0hjn.DHCP.thefacebook.com \
    --to=kuba@kernel.org \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=gnault@redhat.com \
    --cc=netdev@vger.kernel.org \
    --cc=russell@strong.id.au \
    /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.