netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Leonard Crestez <cdleonard@gmail.com>
To: David Ahern <dsahern@gmail.com>,
	Eric Dumazet <edumazet@google.com>,
	David Ahern <dsahern@kernel.org>
Cc: "David S. Miller" <davem@davemloft.net>,
	Hideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,
	Jakub Kicinski <kuba@kernel.org>, Martin KaFai Lau <kafai@fb.com>,
	Kuniyuki Iwashima <kuniyu@amazon.co.jp>,
	Yonghong Song <yhs@fb.com>,
	Alexander Duyck <alexanderduyck@fb.com>,
	Florian Westphal <fw@strlen.de>,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] tcp: md5: Fix overlap between vrf and non-vrf keys
Date: Thu, 7 Oct 2021 09:41:42 +0300	[thread overview]
Message-ID: <912670a5-8ef2-79cc-b74b-ee5c83534f2b@gmail.com> (raw)
In-Reply-To: <209548b5-27d2-2059-f2e9-2148f5a0291b@gmail.com>



On 07.10.2021 04:14, David Ahern wrote:
> On 10/6/21 11:48 AM, Leonard Crestez wrote:
>> @@ -1103,11 +1116,11 @@ static struct tcp_md5sig_key *tcp_md5_do_lookup_exact(const struct sock *sk,
>>   #endif
>>   	hlist_for_each_entry_rcu(key, &md5sig->head, node,
>>   				 lockdep_sock_is_held(sk)) {
>>   		if (key->family != family)
>>   			continue;
>> -		if (key->l3index && key->l3index != l3index)
>> +		if (key->l3index != l3index)
> 
> That seems like the bug fix there. The L3 reference needs to match for
> new key and existing key. I think the same change is needed in
> __tcp_md5_do_lookup.

Current behavior is that keys added without tcpm_ifindex will match 
connections both inside and outside VRFs. Changing this might break real 
applications, is it really OK to claim that this behavior was a bug all 
along?

The approach with most backward compatibility would be to add a new flag 
for keys that only match non-vrf connections.

Alternatively (TCP_MD5SIG_FLAG_IFINDEX && tcpm_ifindex == 0) could be 
defined as "only non-vrf connections" while TCP_MD5SIG_FLAG_IFINDEX 
missing could be "either".

--
Regards,
Leonard

  reply	other threads:[~2021-10-07  6:41 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-06 17:48 [PATCH] tcp: md5: Fix overlap between vrf and non-vrf keys Leonard Crestez
2021-10-07  1:14 ` David Ahern
2021-10-07  6:41   ` Leonard Crestez [this message]
2021-10-07 18:27     ` David Ahern
2021-10-08 15:51       ` Leonard Crestez
2021-10-09 17:19         ` David Ahern

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=912670a5-8ef2-79cc-b74b-ee5c83534f2b@gmail.com \
    --to=cdleonard@gmail.com \
    --cc=alexanderduyck@fb.com \
    --cc=davem@davemloft.net \
    --cc=dsahern@gmail.com \
    --cc=dsahern@kernel.org \
    --cc=edumazet@google.com \
    --cc=fw@strlen.de \
    --cc=kafai@fb.com \
    --cc=kuba@kernel.org \
    --cc=kuniyu@amazon.co.jp \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=yhs@fb.com \
    --cc=yoshfuji@linux-ipv6.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).