[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Zpa3oQuGWPeEyPJK@debian>
Date: Tue, 16 Jul 2024 20:10:41 +0200
From: Guillaume Nault <gnault@...hat.com>
To: Ido Schimmel <idosch@...dia.com>
Cc: netdev@...r.kernel.org, davem@...emloft.net, kuba@...nel.org,
pabeni@...hat.com, edumazet@...gle.com, dsahern@...nel.org,
roopa@...ulusnetworks.com
Subject: Re: [PATCH net 1/2] ipv4: Fix incorrect TOS in route get reply
On Mon, Jul 15, 2024 at 05:23:53PM +0300, Ido Schimmel wrote:
> The TOS value that is returned to user space in the route get reply is
> the one with which the lookup was performed ('fl4->flowi4_tos'). This is
> fine when the matched route is configured with a TOS as it would not
> match if its TOS value did not match the one with which the lookup was
> performed.
>
> However, matching on TOS is only performed when the route's TOS is not
> zero. It is therefore possible to have the kernel incorrectly return a
> non-zero TOS:
>
> # ip link add name dummy1 up type dummy
> # ip address add 192.0.2.1/24 dev dummy1
> # ip route get 192.0.2.2 tos 0xfc
> 192.0.2.2 tos 0x1c dev dummy1 src 192.0.2.1 uid 0
> cache
>
> Fix by adding a DSCP field to the FIB result structure (inside an
> existing 4 bytes hole), populating it in the route lookup and using it
> when filling the route get reply.
>
> Output after the patch:
>
> # ip link add name dummy1 up type dummy
> # ip address add 192.0.2.1/24 dev dummy1
> # ip route get 192.0.2.2 tos 0xfc
> 192.0.2.2 dev dummy1 src 192.0.2.1 uid 0
> cache
Reviewed-by: Guillaume Nault <gnault@...hat.com>
Powered by blists - more mailing lists