netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net] ipv6: Fix use of anycast address with loopback
@ 2020-07-07 13:39 David Ahern
  2020-07-07 20:04 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2020-07-07 13:39 UTC (permalink / raw)
  To: netdev, kuba, davem; +Cc: thomas.gambier, David Ahern

Thomas reported a regression with IPv6 and anycast using the following
reproducer:

    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::

The conversion of addrconf_f6i_alloc to use ip6_route_info_create missed
the use of fib6_is_reject which checks addresses added to the loopback
interface and sets the REJECT flag as needed. Update fib6_is_reject for
loopback checks to handle RTF_ANYCAST addresses.

Fixes: c7a1ce397ada ("ipv6: Change addrconf_f6i_alloc to use ip6_route_info_create")
Reported-by: thomas.gambier@nexedi.com
Signed-off-by: David Ahern <dsahern@kernel.org>
---
 net/ipv6/route.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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;
-- 
2.17.1


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

* Re: [PATCH net] ipv6: Fix use of anycast address with loopback
  2020-07-07 13:39 [PATCH net] ipv6: Fix use of anycast address with loopback David Ahern
@ 2020-07-07 20:04 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-07-07 20:04 UTC (permalink / raw)
  To: dsahern; +Cc: netdev, kuba, thomas.gambier

From: David Ahern <dsahern@kernel.org>
Date: Tue,  7 Jul 2020 07:39:24 -0600

> Thomas reported a regression with IPv6 and anycast using the following
> reproducer:
> 
>     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::
> 
> The conversion of addrconf_f6i_alloc to use ip6_route_info_create missed
> the use of fib6_is_reject which checks addresses added to the loopback
> interface and sets the REJECT flag as needed. Update fib6_is_reject for
> loopback checks to handle RTF_ANYCAST addresses.
> 
> Fixes: c7a1ce397ada ("ipv6: Change addrconf_f6i_alloc to use ip6_route_info_create")
> Reported-by: thomas.gambier@nexedi.com
> Signed-off-by: David Ahern <dsahern@kernel.org>

Applied, and queued up for -stable, thanks David.

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

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

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-07-07 13:39 [PATCH net] ipv6: Fix use of anycast address with loopback David Ahern
2020-07-07 20:04 ` David Miller

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