All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] selftests/net: enable lo.accept_local in psock_snd test
@ 2022-05-20  6:38 Yun Lu
  2022-05-20 13:52 ` Willem de Bruijn
  0 siblings, 1 reply; 7+ messages in thread
From: Yun Lu @ 2022-05-20  6:38 UTC (permalink / raw)
  To: willemb, davem, edumazet; +Cc: netdev, linux-kselftest

From: luyun <luyun@kylinos.cn>

The psock_snd test sends and recievs packets over loopback, but the
parameter lo.accept_local is disabled by default, this test will
fail with Resource temporarily unavailable:
sudo ./psock_snd.sh
dgram
tx: 128
rx: 142
./psock_snd: recv: Resource temporarily unavailable

So enable the parameter lo.accept_local in psock_snd test.

Signed-off-by: luyun <luyun@kylinos.cn>
Reviewed-by: Jackie Liu <liuyun01@kylinos.cn>
---
 tools/testing/selftests/net/psock_snd.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/tools/testing/selftests/net/psock_snd.c b/tools/testing/selftests/net/psock_snd.c
index 7d15e10a9fb6..edf1e6f80d41 100644
--- a/tools/testing/selftests/net/psock_snd.c
+++ b/tools/testing/selftests/net/psock_snd.c
@@ -389,6 +389,8 @@ int main(int argc, char **argv)
 		error(1, errno, "ip link set mtu");
 	if (system("ip addr add dev lo 172.17.0.1/24"))
 		error(1, errno, "ip addr add");
+	if (system("sysctl -w net.ipv4.conf.lo.accept_local=1"))
+		error(1, errno, "sysctl lo.accept_local");
 
 	run_test();
 
-- 
2.25.1


No virus found
		Checked by Hillstone Network AntiVirus


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/net: enable lo.accept_local in psock_snd test
  2022-05-20  6:38 [PATCH] selftests/net: enable lo.accept_local in psock_snd test Yun Lu
@ 2022-05-20 13:52 ` Willem de Bruijn
  2022-05-23  9:19   ` Yun Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Willem de Bruijn @ 2022-05-20 13:52 UTC (permalink / raw)
  To: Yun Lu; +Cc: davem, edumazet, netdev, linux-kselftest

On Fri, May 20, 2022 at 2:40 AM Yun Lu <luyun_611@163.com> wrote:
>
> From: luyun <luyun@kylinos.cn>
>
> The psock_snd test sends and recievs packets over loopback, but the
> parameter lo.accept_local is disabled by default, this test will
> fail with Resource temporarily unavailable:
> sudo ./psock_snd.sh
> dgram
> tx: 128
> rx: 142
> ./psock_snd: recv: Resource temporarily unavailable

I cannot reproduce this failure.

Passes on a machine with accept_local 0.

accept_local is defined as

"
accept_local - BOOLEAN
    Accept packets with local source addresses. In combination
    with suitable routing, this can be used to direct packets
    between two local interfaces over the wire and have them
    accepted properly.
"

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/net: enable lo.accept_local in psock_snd test
  2022-05-20 13:52 ` Willem de Bruijn
@ 2022-05-23  9:19   ` Yun Lu
  2022-05-23 13:32     ` Willem de Bruijn
  0 siblings, 1 reply; 7+ messages in thread
From: Yun Lu @ 2022-05-23  9:19 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: davem, edumazet, netdev, linux-kselftest

On 2022/5/20 下午9:52, Willem de Bruijn wrote:

> On Fri, May 20, 2022 at 2:40 AM Yun Lu <luyun_611@163.com> wrote:
>> From: luyun <luyun@kylinos.cn>
>>
>> The psock_snd test sends and recievs packets over loopback, but the
>> parameter lo.accept_local is disabled by default, this test will
>> fail with Resource temporarily unavailable:
>> sudo ./psock_snd.sh
>> dgram
>> tx: 128
>> rx: 142
>> ./psock_snd: recv: Resource temporarily unavailable
> I cannot reproduce this failure.
>
> Passes on a machine with accept_local 0.
>
> accept_local is defined as
>
> "
> accept_local - BOOLEAN
>      Accept packets with local source addresses. In combination
>      with suitable routing, this can be used to direct packets
>      between two local interfaces over the wire and have them
>      accepted properly.
> "
I did this test on my system(Centos 8.3 X86_64):

[root@localhost net]# sysctl net.ipv4.conf.lo.accept_local
net.ipv4.conf.lo.accept_local = 0
[root@localhost net]# ./psock_snd -d
tx: 128
rx: 142
./psock_snd: recv: Resource temporarily unavailable
[root@localhost net]# sysctl -w net.ipv4.conf.lo.accept_local=1
net.ipv4.conf.lo.accept_local = 1
[root@localhost net]# ./psock_snd -d
tx: 128
rx: 142
rx: 100
OK

This failure does seem to be related to accept_local.

Also, it's reported on Ubuntu:
https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/1812618


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/net: enable lo.accept_local in psock_snd test
  2022-05-23  9:19   ` Yun Lu
@ 2022-05-23 13:32     ` Willem de Bruijn
  2022-05-24 10:03       ` Yun Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Willem de Bruijn @ 2022-05-23 13:32 UTC (permalink / raw)
  To: Yun Lu; +Cc: Willem de Bruijn, davem, edumazet, netdev, linux-kselftest

On Mon, May 23, 2022 at 5:25 AM Yun Lu <luyun_611@163.com> wrote:
>
> On 2022/5/20 下午9:52, Willem de Bruijn wrote:
>
> > On Fri, May 20, 2022 at 2:40 AM Yun Lu <luyun_611@163.com> wrote:
> >> From: luyun <luyun@kylinos.cn>
> >>
> >> The psock_snd test sends and recievs packets over loopback, but the
> >> parameter lo.accept_local is disabled by default, this test will
> >> fail with Resource temporarily unavailable:
> >> sudo ./psock_snd.sh
> >> dgram
> >> tx: 128
> >> rx: 142
> >> ./psock_snd: recv: Resource temporarily unavailable
> > I cannot reproduce this failure.
> >
> > Passes on a machine with accept_local 0.
> >
> > accept_local is defined as
> >
> > "
> > accept_local - BOOLEAN
> >      Accept packets with local source addresses. In combination
> >      with suitable routing, this can be used to direct packets
> >      between two local interfaces over the wire and have them
> >      accepted properly.
> > "
> I did this test on my system(Centos 8.3 X86_64):
>
> [root@localhost net]# sysctl net.ipv4.conf.lo.accept_local
> net.ipv4.conf.lo.accept_local = 0
> [root@localhost net]# ./psock_snd -d
> tx: 128
> rx: 142
> ./psock_snd: recv: Resource temporarily unavailable
> [root@localhost net]# sysctl -w net.ipv4.conf.lo.accept_local=1
> net.ipv4.conf.lo.accept_local = 1
> [root@localhost net]# ./psock_snd -d
> tx: 128
> rx: 142
> rx: 100
> OK
>
> This failure does seem to be related to accept_local.
>
> Also, it's reported on Ubuntu:
> https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/1812618

That is an old kernel, 4.18 derived.

I simply am unable to reproduce this on an upstream v4.18 or v5.18.
Likely something with either the distro kernel release, or another
distro feature that interacts with this. Can you try v5.18 or another
clean upstream kernel?

Else it requires instrumenting IN_DEV_ACCEPT_LOCAL tests to understand
where this sysctl makes a meaningful change for you when running this
test.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/net: enable lo.accept_local in psock_snd test
  2022-05-23 13:32     ` Willem de Bruijn
@ 2022-05-24 10:03       ` Yun Lu
  2022-05-24 13:33         ` Willem de Bruijn
  0 siblings, 1 reply; 7+ messages in thread
From: Yun Lu @ 2022-05-24 10:03 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: davem, edumazet, netdev, linux-kselftest

On 2022/5/23 下午9:32, Willem de Bruijn wrote:

> On Mon, May 23, 2022 at 5:25 AM Yun Lu <luyun_611@163.com> wrote:
>> On 2022/5/20 下午9:52, Willem de Bruijn wrote:
>>
>>> On Fri, May 20, 2022 at 2:40 AM Yun Lu <luyun_611@163.com> wrote:
>>>> From: luyun <luyun@kylinos.cn>
>>>>
>>>> The psock_snd test sends and recievs packets over loopback, but the
>>>> parameter lo.accept_local is disabled by default, this test will
>>>> fail with Resource temporarily unavailable:
>>>> sudo ./psock_snd.sh
>>>> dgram
>>>> tx: 128
>>>> rx: 142
>>>> ./psock_snd: recv: Resource temporarily unavailable
>>> I cannot reproduce this failure.
>>>
>>> Passes on a machine with accept_local 0.
>>>
>>> accept_local is defined as
>>>
>>> "
>>> accept_local - BOOLEAN
>>>       Accept packets with local source addresses. In combination
>>>       with suitable routing, this can be used to direct packets
>>>       between two local interfaces over the wire and have them
>>>       accepted properly.
>>> "
>> I did this test on my system(Centos 8.3 X86_64):
>>
>> [root@localhost net]# sysctl net.ipv4.conf.lo.accept_local
>> net.ipv4.conf.lo.accept_local = 0
>> [root@localhost net]# ./psock_snd -d
>> tx: 128
>> rx: 142
>> ./psock_snd: recv: Resource temporarily unavailable
>> [root@localhost net]# sysctl -w net.ipv4.conf.lo.accept_local=1
>> net.ipv4.conf.lo.accept_local = 1
>> [root@localhost net]# ./psock_snd -d
>> tx: 128
>> rx: 142
>> rx: 100
>> OK
>>
>> This failure does seem to be related to accept_local.
>>
>> Also, it's reported on Ubuntu:
>> https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/1812618
> That is an old kernel, 4.18 derived.
>
> I simply am unable to reproduce this on an upstream v4.18 or v5.18.
> Likely something with either the distro kernel release, or another
> distro feature that interacts with this. Can you try v5.18 or another
> clean upstream kernel?
>
> Else it requires instrumenting IN_DEV_ACCEPT_LOCAL tests to understand
> where this sysctl makes a meaningful change for you when running this
> test.

I found another parameter rp_filter which interacts with this test:

Set rp_filter = 0, the psock_snd test OK.

Or set rp_filter = 1 and accept_local=1, the psock_snd test OK.

I get the same test results on kernel v5.10 or v5.15.  Analysis from 
source code,  this two parameters

will change the result of fib_validate_source when running this test. 
For most distro kernel releases,

rp_filter is enabled by default, so this test will fail when 
accept_local is kept to be zero.


I am looking forward to your better advice on this problem.


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/net: enable lo.accept_local in psock_snd test
  2022-05-24 10:03       ` Yun Lu
@ 2022-05-24 13:33         ` Willem de Bruijn
  2022-05-25  1:48           ` Yun Lu
  0 siblings, 1 reply; 7+ messages in thread
From: Willem de Bruijn @ 2022-05-24 13:33 UTC (permalink / raw)
  To: Yun Lu; +Cc: Willem de Bruijn, davem, edumazet, netdev, linux-kselftest

On Tue, May 24, 2022 at 6:04 AM Yun Lu <luyun_611@163.com> wrote:
>
> On 2022/5/23 下午9:32, Willem de Bruijn wrote:
>
> > On Mon, May 23, 2022 at 5:25 AM Yun Lu <luyun_611@163.com> wrote:
> >> On 2022/5/20 下午9:52, Willem de Bruijn wrote:
> >>
> >>> On Fri, May 20, 2022 at 2:40 AM Yun Lu <luyun_611@163.com> wrote:
> >>>> From: luyun <luyun@kylinos.cn>
> >>>>
> >>>> The psock_snd test sends and recievs packets over loopback, but the
> >>>> parameter lo.accept_local is disabled by default, this test will
> >>>> fail with Resource temporarily unavailable:
> >>>> sudo ./psock_snd.sh
> >>>> dgram
> >>>> tx: 128
> >>>> rx: 142
> >>>> ./psock_snd: recv: Resource temporarily unavailable
> >>> I cannot reproduce this failure.
> >>>
> >>> Passes on a machine with accept_local 0.
> >>>
> >>> accept_local is defined as
> >>>
> >>> "
> >>> accept_local - BOOLEAN
> >>>       Accept packets with local source addresses. In combination
> >>>       with suitable routing, this can be used to direct packets
> >>>       between two local interfaces over the wire and have them
> >>>       accepted properly.
> >>> "
> >> I did this test on my system(Centos 8.3 X86_64):
> >>
> >> [root@localhost net]# sysctl net.ipv4.conf.lo.accept_local
> >> net.ipv4.conf.lo.accept_local = 0
> >> [root@localhost net]# ./psock_snd -d
> >> tx: 128
> >> rx: 142
> >> ./psock_snd: recv: Resource temporarily unavailable
> >> [root@localhost net]# sysctl -w net.ipv4.conf.lo.accept_local=1
> >> net.ipv4.conf.lo.accept_local = 1
> >> [root@localhost net]# ./psock_snd -d
> >> tx: 128
> >> rx: 142
> >> rx: 100
> >> OK
> >>
> >> This failure does seem to be related to accept_local.
> >>
> >> Also, it's reported on Ubuntu:
> >> https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/1812618
> > That is an old kernel, 4.18 derived.
> >
> > I simply am unable to reproduce this on an upstream v4.18 or v5.18.
> > Likely something with either the distro kernel release, or another
> > distro feature that interacts with this. Can you try v5.18 or another
> > clean upstream kernel?
> >
> > Else it requires instrumenting IN_DEV_ACCEPT_LOCAL tests to understand
> > where this sysctl makes a meaningful change for you when running this
> > test.
>
> I found another parameter rp_filter which interacts with this test:
>
> Set rp_filter = 0, the psock_snd test OK.
>
> Or set rp_filter = 1 and accept_local=1, the psock_snd test OK.
>
> I get the same test results on kernel v5.10 or v5.15.  Analysis from
> source code,  this two parameters
>
> will change the result of fib_validate_source when running this test.
> For most distro kernel releases,
>
> rp_filter is enabled by default, so this test will fail when
> accept_local is kept to be zero.

That explains.

Since this test runs inside a netns, changing a sysctl is fine.

Can you resubmit with a more detailed description now that the exact
check is more clear, as well as interplay with rp_filter, and the
default config of these two parameters configured by distros? Thanks.
Please double check typos (s/recievs/receives).

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] selftests/net: enable lo.accept_local in psock_snd test
  2022-05-24 13:33         ` Willem de Bruijn
@ 2022-05-25  1:48           ` Yun Lu
  0 siblings, 0 replies; 7+ messages in thread
From: Yun Lu @ 2022-05-25  1:48 UTC (permalink / raw)
  To: Willem de Bruijn; +Cc: davem, edumazet, netdev, linux-kselftest

On 2022/5/24 下午9:33, Willem de Bruijn wrote:

> On Tue, May 24, 2022 at 6:04 AM Yun Lu <luyun_611@163.com> wrote:
>> On 2022/5/23 下午9:32, Willem de Bruijn wrote:
>>
>>> On Mon, May 23, 2022 at 5:25 AM Yun Lu <luyun_611@163.com> wrote:
>>>> On 2022/5/20 下午9:52, Willem de Bruijn wrote:
>>>>
>>>>> On Fri, May 20, 2022 at 2:40 AM Yun Lu <luyun_611@163.com> wrote:
>>>>>> From: luyun <luyun@kylinos.cn>
>>>>>>
>>>>>> The psock_snd test sends and recievs packets over loopback, but the
>>>>>> parameter lo.accept_local is disabled by default, this test will
>>>>>> fail with Resource temporarily unavailable:
>>>>>> sudo ./psock_snd.sh
>>>>>> dgram
>>>>>> tx: 128
>>>>>> rx: 142
>>>>>> ./psock_snd: recv: Resource temporarily unavailable
>>>>> I cannot reproduce this failure.
>>>>>
>>>>> Passes on a machine with accept_local 0.
>>>>>
>>>>> accept_local is defined as
>>>>>
>>>>> "
>>>>> accept_local - BOOLEAN
>>>>>        Accept packets with local source addresses. In combination
>>>>>        with suitable routing, this can be used to direct packets
>>>>>        between two local interfaces over the wire and have them
>>>>>        accepted properly.
>>>>> "
>>>> I did this test on my system(Centos 8.3 X86_64):
>>>>
>>>> [root@localhost net]# sysctl net.ipv4.conf.lo.accept_local
>>>> net.ipv4.conf.lo.accept_local = 0
>>>> [root@localhost net]# ./psock_snd -d
>>>> tx: 128
>>>> rx: 142
>>>> ./psock_snd: recv: Resource temporarily unavailable
>>>> [root@localhost net]# sysctl -w net.ipv4.conf.lo.accept_local=1
>>>> net.ipv4.conf.lo.accept_local = 1
>>>> [root@localhost net]# ./psock_snd -d
>>>> tx: 128
>>>> rx: 142
>>>> rx: 100
>>>> OK
>>>>
>>>> This failure does seem to be related to accept_local.
>>>>
>>>> Also, it's reported on Ubuntu:
>>>> https://bugs.launchpad.net/ubuntu-kernel-tests/+bug/1812618
>>> That is an old kernel, 4.18 derived.
>>>
>>> I simply am unable to reproduce this on an upstream v4.18 or v5.18.
>>> Likely something with either the distro kernel release, or another
>>> distro feature that interacts with this. Can you try v5.18 or another
>>> clean upstream kernel?
>>>
>>> Else it requires instrumenting IN_DEV_ACCEPT_LOCAL tests to understand
>>> where this sysctl makes a meaningful change for you when running this
>>> test.
>> I found another parameter rp_filter which interacts with this test:
>>
>> Set rp_filter = 0, the psock_snd test OK.
>>
>> Or set rp_filter = 1 and accept_local=1, the psock_snd test OK.
>>
>> I get the same test results on kernel v5.10 or v5.15.  Analysis from
>> source code,  this two parameters
>>
>> will change the result of fib_validate_source when running this test.
>> For most distro kernel releases,
>>
>> rp_filter is enabled by default, so this test will fail when
>> accept_local is kept to be zero.
> That explains.
>
> Since this test runs inside a netns, changing a sysctl is fine.
>
> Can you resubmit with a more detailed description now that the exact
> check is more clear, as well as interplay with rp_filter, and the
> default config of these two parameters configured by distros? Thanks.
> Please double check typos (s/recievs/receives).
OK, thanks for your reply and suggestion. I will send v2 version of this 
patch soon.


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-05-25  1:48 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-20  6:38 [PATCH] selftests/net: enable lo.accept_local in psock_snd test Yun Lu
2022-05-20 13:52 ` Willem de Bruijn
2022-05-23  9:19   ` Yun Lu
2022-05-23 13:32     ` Willem de Bruijn
2022-05-24 10:03       ` Yun Lu
2022-05-24 13:33         ` Willem de Bruijn
2022-05-25  1:48           ` Yun Lu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.