[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20220518081159.GS680067@gauss3.secunet.de>
Date: Wed, 18 May 2022 10:11:59 +0200
From: Steffen Klassert <steffen.klassert@...unet.com>
To: Eyal Birger <eyal.birger@...il.com>
CC: <davem@...emloft.net>, <yoshfuji@...ux-ipv6.org>,
<dsahern@...nel.org>, <edumazet@...gle.com>, <kuba@...nel.org>,
<pabeni@...hat.com>, <herbert@...dor.apana.org.au>,
<nicolas.dichtel@...nd.com>, <netdev@...r.kernel.org>,
Shmulik Ladkani <shmulik.ladkani@...il.com>
Subject: Re: [PATCH ipsec,v2] xfrm: fix "disable_policy" flag use when
arriving from different devices
On Fri, May 13, 2022 at 11:34:02PM +0300, Eyal Birger wrote:
> In IPv4 setting the "disable_policy" flag on a device means no policy
> should be enforced for traffic originating from the device. This was
> implemented by seting the DST_NOPOLICY flag in the dst based on the
> originating device.
>
> However, dsts are cached in nexthops regardless of the originating
> devices, in which case, the DST_NOPOLICY flag value may be incorrect.
>
> Consider the following setup:
>
> +------------------------------+
> | ROUTER |
> +-------------+ | +-----------------+ |
> | ipsec src |----|-|ipsec0 | |
> +-------------+ | |disable_policy=0 | +----+ |
> | +-----------------+ |eth1|-|-----
> +-------------+ | +-----------------+ +----+ |
> | noipsec src |----|-|eth0 | |
> +-------------+ | |disable_policy=1 | |
> | +-----------------+ |
> +------------------------------+
>
> Where ROUTER has a default route towards eth1.
>
> dst entries for traffic arriving from eth0 would have DST_NOPOLICY
> and would be cached and therefore can be reused by traffic originating
> from ipsec0, skipping policy check.
>
> Fix by setting a IPSKB_NOPOLICY flag in IPCB and observing it instead
> of the DST in IN/FWD IPv4 policy checks.
>
> Fixes: 1da177e4c3f4 ("Linux-2.6.12-rc2")
> Reported-by: Shmulik Ladkani <shmulik.ladkani@...il.com>
> Signed-off-by: Eyal Birger <eyal.birger@...il.com>
>
> ---
>
> v2: set IPSKB_NOPOLICY in ip_route_input_mc() as needed
Applied, thanks a lot Eyal!
Powered by blists - more mailing lists