[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <cb80378b-a8da-7dea-ea71-eed25a21a345@gmail.com>
Date: Sun, 12 Jun 2022 21:52:43 -0600
From: David Ahern <dsahern@...il.com>
To: Benjamin Poirier <bpoirier@...dia.com>,
Mike Manning <mvrmanning@...il.com>
Cc: Netdev <netdev@...r.kernel.org>,
Saikrishna Arcot <sarcot@...rosoft.com>,
Craig Gallek <kraig@...gle.com>
Subject: Re: [PATCH] net: prefer socket bound to interface when not in VRF
On 6/12/22 9:14 PM, Benjamin Poirier wrote:
> On 2021-10-05 14:03 +0100, Mike Manning wrote:
> [...]
>>
>> Fixes: 6da5b0f027a8 ("net: ensure unbound datagram socket to be chosen when not in a VRF")
>> Fixes: e78190581aff ("net: ensure unbound stream socket to be chosen when not in a VRF")
>> Signed-off-by: Mike Manning <mmanning@...tta.att-mail.com>
>> ---
>>
>> diff nettest-baseline-9e9fb7655ed5.txt nettest-fix.txt
>> 955,956c955,956
>> < TEST: IPv4 TCP connection over VRF with SNAT [FAIL]
>> < TEST: IPv6 TCP connection over VRF with SNAT [FAIL]
>> ---
>>> TEST: IPv4 TCP connection over VRF with SNAT [ OK ]
>>> TEST: IPv6 TCP connection over VRF with SNAT [ OK ]
>> 958,959c958,959
>> < Tests passed: 713
>> < Tests failed: 5
>> ---
>>> Tests passed: 715
>>> Tests failed: 3
>>
>> ---
>> net/ipv4/inet_hashtables.c | 4 +++-
>> net/ipv4/udp.c | 3 ++-
>> net/ipv6/inet6_hashtables.c | 2 +-
>> net/ipv6/udp.c | 3 ++-
>> 4 files changed, 8 insertions(+), 4 deletions(-)
>>
>
> Hi Mike,
>
> I was looking at this commit, 8d6c414cd2fb ("net: prefer socket bound to
> interface when not in VRF"), and I get the feeling that it is only
> partially effective. It works with UDP connected sockets but it doesn't
> work for TCP and UDP unconnected sockets.
>
> The compute_score() functions are a bit misleading. Because of the
> reuseport shortcut in their callers (inet_lhash2_lookup() and the like),
> the first socket with score > 0 may be chosen, not necessarily the
> socket with highest score. In order to prefer certain sockets, I think
> an approach like commit d894ba18d4e4 ("soreuseport: fix ordering for
> mixed v4/v6 sockets") would be needed. What do you think?
>
> Extra info:
> 1) fcnal-test.sh results
>
> I tried to reproduce the fcnal-test.sh test results quoted above but in
> my case the test cases already pass at 8d6c414cd2fb^ and 9e9fb7655ed5.
> Moreover I believe those test cases don't have multiple listening
> sockets. So that just added to my confusion.
>
> Running 9e9fb7655ed5,
> root@...d:/src/linux/tools/testing/selftests/net# ./fcnal-test.sh -t use_cases
use_cases group is a catchall for bug reports. You want run all of the
TCP and UDP cases to cover socket permutations and I know some of those
cover dual listeners (though I can't remember ATM if that is only the
MD5 tests). If not, you can add them fairly easily and illustrate your
point.
As for compute_score, it does weight device binds a bit higher. TCP:
score = sk->sk_bound_dev_if ? 2 : 1;
UDP:
if (sk->sk_bound_dev_if)
score += 4;
Powered by blists - more mailing lists