Thread (6 messages) flat view 6 messages, 2 authors, 2021-10-09

Re: [PATCH] tcp: md5: Fix overlap between vrf and non-vrf keys

From: Leonard Crestez <hidden>
Date: 2021-10-07 06:41:52
Also in: lkml


On 07.10.2021 04:14, David Ahern wrote:
On 10/6/21 11:48 AM, Leonard Crestez wrote:
quoted
@@ -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
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help