All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net] ipv6: Revert "ipv6: Allow non-gateway ECMP for IPv6"
@ 2018-05-02 19:41 Ido Schimmel
  2018-05-02 19:50 ` Eric Dumazet
  2018-05-02 20:33 ` David Miller
  0 siblings, 2 replies; 3+ messages in thread
From: Ido Schimmel @ 2018-05-02 19:41 UTC (permalink / raw)
  To: netdev; +Cc: davem, dsahern, eric.dumazet, Thomas.Winter, mlxsw, Ido Schimmel

This reverts commit edd7ceb78296 ("ipv6: Allow non-gateway ECMP for
IPv6").

Eric reported a division by zero in rt6_multipath_rebalance() which is
caused by above commit that considers identical local routes to be
siblings. The division by zero happens because a nexthop weight is not
set for local routes.

Revert the commit as it does not fix a bug and has side effects.

To reproduce:

# ip -6 address add 2001:db8::1/64 dev dummy0
# ip -6 address add 2001:db8::1/64 dev dummy1

Fixes: edd7ceb78296 ("ipv6: Allow non-gateway ECMP for IPv6")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
---
 include/net/ip6_route.h | 3 ++-
 net/ipv6/ip6_fib.c      | 3 +++
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index abceb5864d99..08b132381984 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -68,7 +68,8 @@ static inline bool rt6_need_strict(const struct in6_addr *daddr)
 
 static inline bool rt6_qualify_for_ecmp(const struct rt6_info *rt)
 {
-	return (rt->rt6i_flags & (RTF_ADDRCONF | RTF_DYNAMIC)) == 0;
+	return (rt->rt6i_flags & (RTF_GATEWAY|RTF_ADDRCONF|RTF_DYNAMIC)) ==
+	       RTF_GATEWAY;
 }
 
 void ip6_route_input(struct sk_buff *skb);
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index 3c97c29d4401..deab2db6692e 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -934,6 +934,9 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
 			 * list.
 			 * Only static routes (which don't have flag
 			 * RTF_EXPIRES) are used for ECMPv6.
+			 *
+			 * To avoid long list, we only had siblings if the
+			 * route have a gateway.
 			 */
 			if (rt_can_ecmp &&
 			    rt6_qualify_for_ecmp(iter))
-- 
2.14.3

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

* Re: [PATCH net] ipv6: Revert "ipv6: Allow non-gateway ECMP for IPv6"
  2018-05-02 19:41 [PATCH net] ipv6: Revert "ipv6: Allow non-gateway ECMP for IPv6" Ido Schimmel
@ 2018-05-02 19:50 ` Eric Dumazet
  2018-05-02 20:33 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: Eric Dumazet @ 2018-05-02 19:50 UTC (permalink / raw)
  To: Ido Schimmel, netdev; +Cc: davem, dsahern, eric.dumazet, Thomas.Winter, mlxsw



On 05/02/2018 12:41 PM, Ido Schimmel wrote:
> This reverts commit edd7ceb78296 ("ipv6: Allow non-gateway ECMP for
> IPv6").
> 
> Eric reported a division by zero in rt6_multipath_rebalance() which is
> caused by above commit that considers identical local routes to be
> siblings. The division by zero happens because a nexthop weight is not
> set for local routes.
> 
> Revert the commit as it does not fix a bug and has side effects.
> 
> To reproduce:
> 
> # ip -6 address add 2001:db8::1/64 dev dummy0
> # ip -6 address add 2001:db8::1/64 dev dummy1
> 
> Fixes: edd7ceb78296 ("ipv6: Allow non-gateway ECMP for IPv6")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>
> ---

Tested-by: Eric Dumazet <edumazet@google.com>

Thanks for fixing this !

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

* Re: [PATCH net] ipv6: Revert "ipv6: Allow non-gateway ECMP for IPv6"
  2018-05-02 19:41 [PATCH net] ipv6: Revert "ipv6: Allow non-gateway ECMP for IPv6" Ido Schimmel
  2018-05-02 19:50 ` Eric Dumazet
@ 2018-05-02 20:33 ` David Miller
  1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2018-05-02 20:33 UTC (permalink / raw)
  To: idosch; +Cc: netdev, dsahern, eric.dumazet, Thomas.Winter, mlxsw

From: Ido Schimmel <idosch@mellanox.com>
Date: Wed,  2 May 2018 22:41:56 +0300

> This reverts commit edd7ceb78296 ("ipv6: Allow non-gateway ECMP for
> IPv6").
> 
> Eric reported a division by zero in rt6_multipath_rebalance() which is
> caused by above commit that considers identical local routes to be
> siblings. The division by zero happens because a nexthop weight is not
> set for local routes.
> 
> Revert the commit as it does not fix a bug and has side effects.
> 
> To reproduce:
> 
> # ip -6 address add 2001:db8::1/64 dev dummy0
> # ip -6 address add 2001:db8::1/64 dev dummy1
> 
> Fixes: edd7ceb78296 ("ipv6: Allow non-gateway ECMP for IPv6")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Reported-by: Eric Dumazet <eric.dumazet@gmail.com>

Applied, thank you.

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

end of thread, other threads:[~2018-05-02 20:33 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-02 19:41 [PATCH net] ipv6: Revert "ipv6: Allow non-gateway ECMP for IPv6" Ido Schimmel
2018-05-02 19:50 ` Eric Dumazet
2018-05-02 20:33 ` David Miller

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.