netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* PROBLEM: can't ping anycast IPv6 address on lo interface
@ 2020-06-26  9:20 thomas.gambier
  2020-07-07  0:25 ` David Ahern
  0 siblings, 1 reply; 3+ messages in thread
From: thomas.gambier @ 2020-06-26  9:20 UTC (permalink / raw)
  To: David Ahern, David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
  Cc: netdev, Julien Muchembled, Jean-Paul Smets

[-- Attachment #1: Type: text/plain, Size: 2268 bytes --]

Hello,

this is the first time I report a bug to the kernel team. Please let me 
know if there are any missing information or if I should post on 
bugzilla instead.


Since Linux 5.2, I can't ping anycast address on lo interface.

If you enable IPv6 forwarding for an interface and add a IPv6 address 
range on this interface, it is possible to ping the addres 0 of the 
range (anycast address). This doesn't work for "lo" interface since 
Linux 5.2.

I bisected to find that the commit 
c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43 
(https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43) 
introduced the regression. Please note that the regression is still 
present on master branch of net repository (commit 
2570284060b48f3f79d8f1a2698792f36c385e9a from yesterday).

I attach my config file to this email (this config was used to compile 
latest master branch).

In order to reproduce you can use this small script:

root@kernel-compil-vm:~# cat test.bash
#! /bin/bash
echo 1 >  /proc/sys/net/ipv6/conf/all/forwarding
ip -6 a add fc12::1/16 dev lo
sleep 2
echo "pinging lo"
ping6 -c 2 fc12::


Before the regression you will see:
pinging lo
PING fc12::(fc12::) 56 data bytes
64 bytes from fc12::1: icmp_seq=1 ttl=64 time=0.111 ms
64 bytes from fc12::1: icmp_seq=2 ttl=64 time=0.062 ms


After the regression you will see:
pinging lo
PING fc12::(fc12::) 56 data bytes
 From fc12::: icmp_seq=1 Destination unreachable: No route
 From fc12::: icmp_seq=2 Destination unreachable: No route




Please note that if you test this on any physical ethernet interface, it 
still works properly.


For a bit of context, I'm one of the maintainer of re6st 
(https://re6st.nexedi.com) free software. This software gives an IPv6 
address range to a machine. By default it will assign it to lo interface 
and the current implementation is giving the address 1 of the range to 
the machine. But in order to keep maximum flexibility, we are contacting 
the machines on the re6st network using the anycast address of the 
range. We started to notice that it didn't work anymore on Ubuntu 20.04 
(Linux 5.4) and then we started to investigate up to this bug report.


Let me know if you need anything else.

Regards.

Thomas.

[-- Attachment #2: config.gz --]
[-- Type: application/x-gzip, Size: 33986 bytes --]

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

* Re: PROBLEM: can't ping anycast IPv6 address on lo interface
  2020-06-26  9:20 PROBLEM: can't ping anycast IPv6 address on lo interface thomas.gambier
@ 2020-07-07  0:25 ` David Ahern
  2020-07-07  8:24   ` thomas.gambier
  0 siblings, 1 reply; 3+ messages in thread
From: David Ahern @ 2020-07-07  0:25 UTC (permalink / raw)
  To: thomas.gambier, David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI
  Cc: netdev, Julien Muchembled, Jean-Paul Smets

[ sorry for the delay; on PTO for a couple weeks ]

On 6/26/20 3:20 AM, thomas.gambier@nexedi.com wrote:
> Hello,
> 
> this is the first time I report a bug to the kernel team. Please let me
> know if there are any missing information or if I should post on
> bugzilla instead.
> 
> 
> Since Linux 5.2, I can't ping anycast address on lo interface.
> 
> If you enable IPv6 forwarding for an interface and add a IPv6 address
> range on this interface, it is possible to ping the addres 0 of the
> range (anycast address). This doesn't work for "lo" interface since
> Linux 5.2.
> 
> I bisected to find that the commit
> c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43
> (https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43)
> introduced the regression. Please note that the regression is still
> present on master branch of net repository (commit
> 2570284060b48f3f79d8f1a2698792f36c385e9a from yesterday).
> 
> I attach my config file to this email (this config was used to compile
> latest master branch).
> 
> In order to reproduce you can use this small script:
> 
> root@kernel-compil-vm:~# cat test.bash
> #! /bin/bash
> echo 1 >  /proc/sys/net/ipv6/conf/all/forwarding
> ip -6 a add fc12::1/16 dev lo
> sleep 2
> echo "pinging lo"
> ping6 -c 2 fc12::
> 

Thanks for the quick reproducer.

> 
> Before the regression you will see:
> pinging lo
> PING fc12::(fc12::) 56 data bytes
> 64 bytes from fc12::1: icmp_seq=1 ttl=64 time=0.111 ms
> 64 bytes from fc12::1: icmp_seq=2 ttl=64 time=0.062 ms
> 
> 
> After the regression you will see:
> pinging lo
> PING fc12::(fc12::) 56 data bytes
> From fc12::: icmp_seq=1 Destination unreachable: No route
> From fc12::: icmp_seq=2 Destination unreachable: No route
> 

This solves the problem for me; can you try it out in your environment?

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index ea0be7cf3d93..f3279810d765 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3405,7 +3405,7 @@ static bool fib6_is_reject(u32 flags, struct
net_device *dev, int addr_type)
        if ((flags & RTF_REJECT) ||
            (dev && (dev->flags & IFF_LOOPBACK) &&
             !(addr_type & IPV6_ADDR_LOOPBACK) &&
-            !(flags & RTF_LOCAL)))
+            !(flags & (RTF_ANYCAST | RTF_LOCAL))))
                return true;

        return false;

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

* Re: PROBLEM: can't ping anycast IPv6 address on lo interface
  2020-07-07  0:25 ` David Ahern
@ 2020-07-07  8:24   ` thomas.gambier
  0 siblings, 0 replies; 3+ messages in thread
From: thomas.gambier @ 2020-07-07  8:24 UTC (permalink / raw)
  To: David Ahern
  Cc: David S. Miller, Alexey Kuznetsov, Hideaki YOSHIFUJI, netdev,
	Julien Muchembled, Jean-Paul Smets, Juliusz Chroboczek

On 2020-07-07 02:25, David Ahern wrote:
> [ sorry for the delay; on PTO for a couple weeks ]
>
> On 6/26/20 3:20 AM, thomas.gambier@nexedi.com wrote:
>> Hello,
>>
>> this is the first time I report a bug to the kernel team. Please let
>> me
>> know if there are any missing information or if I should post on
>> bugzilla instead.
>>
>>
>> Since Linux 5.2, I can't ping anycast address on lo interface.
>>
>> If you enable IPv6 forwarding for an interface and add a IPv6 address
>> range on this interface, it is possible to ping the addres 0 of the
>> range (anycast address). This doesn't work for "lo" interface since
>> Linux 5.2.
>>
>> I bisected to find that the commit
>> c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43
>> (https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/commit/?id=c7a1ce397adacaf5d4bb2eab0a738b5f80dc3e43)
>> introduced the regression. Please note that the regression is still
>> present on master branch of net repository (commit
>> 2570284060b48f3f79d8f1a2698792f36c385e9a from yesterday).
>>
>> I attach my config file to this email (this config was used to compile
>> latest master branch).
>>
>> In order to reproduce you can use this small script:
>>
>> root@kernel-compil-vm:~# cat test.bash
>> #! /bin/bash
>> echo 1 >  /proc/sys/net/ipv6/conf/all/forwarding
>> ip -6 a add fc12::1/16 dev lo
>> sleep 2
>> echo "pinging lo"
>> ping6 -c 2 fc12::
>>
>
> Thanks for the quick reproducer.
>
>>
>> Before the regression you will see:
>> pinging lo
>> PING fc12::(fc12::) 56 data bytes
>> 64 bytes from fc12::1: icmp_seq=1 ttl=64 time=0.111 ms
>> 64 bytes from fc12::1: icmp_seq=2 ttl=64 time=0.062 ms
>>
>>
>> After the regression you will see:
>> pinging lo
>> PING fc12::(fc12::) 56 data bytes
>> From fc12::: icmp_seq=1 Destination unreachable: No route
>> From fc12::: icmp_seq=2 Destination unreachable: No route
>>
>
> This solves the problem for me; can you try it out in your environment?
>
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index ea0be7cf3d93..f3279810d765 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -3405,7 +3405,7 @@ static bool fib6_is_reject(u32 flags, struct
> net_device *dev, int addr_type)
>         if ((flags & RTF_REJECT) ||
>             (dev && (dev->flags & IFF_LOOPBACK) &&
>              !(addr_type & IPV6_ADDR_LOOPBACK) &&
> -            !(flags & RTF_LOCAL)))
> +            !(flags & (RTF_ANYCAST | RTF_LOCAL))))
>                 return true;
>
>         return false;

Yes, I confirm this patch solves the bug.

Thank you very much.


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

end of thread, other threads:[~2020-07-07  8:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-26  9:20 PROBLEM: can't ping anycast IPv6 address on lo interface thomas.gambier
2020-07-07  0:25 ` David Ahern
2020-07-07  8:24   ` thomas.gambier

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).