[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <65cb2c9f-28f8-8570-3275-b1080232a7f8@gmail.com>
Date: Wed, 13 Oct 2021 21:05:39 -0600
From: David Ahern <dsahern@...il.com>
To: Leonard Crestez <cdleonard@...il.com>,
David Ahern <dsahern@...nel.org>,
Eric Dumazet <edumazet@...gle.com>
Cc: "David S. Miller" <davem@...emloft.net>,
Hideaki YOSHIFUJI <yoshfuji@...ux-ipv6.org>,
Jakub Kicinski <kuba@...nel.org>,
Martin KaFai Lau <kafai@...com>,
Kuniyuki Iwashima <kuniyu@...zon.co.jp>,
Yonghong Song <yhs@...com>,
Alexander Duyck <alexanderduyck@...com>,
Florian Westphal <fw@...len.de>, netdev@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/4] tcp: md5: Fix overlap between vrf and non-vrf keys
On 10/13/21 12:50 AM, Leonard Crestez wrote:
> With net.ipv4.tcp_l3mdev_accept=1 it is possible for a listen socket to
> accept connection from the same client address in different VRFs. It is
> also possible to set different MD5 keys for these clients which differ
> only in the tcpm_l3index field.
>
> This appears to work when distinguishing between different VRFs but not
> between non-VRF and VRF connections. In particular:
>
> * tcp_md5_do_lookup_exact will match a non-vrf key against a vrf key.
> This means that adding a key with l3index != 0 after a key with l3index
> == 0 will cause the earlier key to be deleted. Both keys can be present
> if the non-vrf key is added later.
> * _tcp_md5_do_lookup can match a non-vrf key before a vrf key. This
> casues failures if the passwords differ.
>
> Fix this by making tcp_md5_do_lookup_exact perform an actual exact
> comparison on l3index and by making __tcp_md5_do_lookup perfer
> vrf-bound keys above other considerations like prefixlen.
>
> Fixes: dea53bb80e07 ("tcp: Add l3index to tcp_md5sig_key and md5 functions")
> Signed-off-by: Leonard Crestez <cdleonard@...il.com>
> ---
> net/ipv4/tcp_ipv4.c | 19 ++++++++++++++++---
> 1 file changed, 16 insertions(+), 3 deletions(-)
>
Reviewed-by: David Ahern <dsahern@...nel.org>
Powered by blists - more mailing lists