Skip to content

Commit 30ca22e

Browse files
idoschdavem330
authored andcommitted
ipv6: Revert "ipv6: Allow non-gateway ECMP for IPv6"
This reverts commit edd7ceb ("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: edd7ceb ("ipv6: Allow non-gateway ECMP for IPv6") Signed-off-by: Ido Schimmel <[email protected]> Reported-by: Eric Dumazet <[email protected]> Tested-by: Eric Dumazet <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 784813a commit 30ca22e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

include/net/ip6_route.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,8 @@ static inline bool rt6_need_strict(const struct in6_addr *daddr)
6868

6969
static inline bool rt6_qualify_for_ecmp(const struct rt6_info *rt)
7070
{
71-
return (rt->rt6i_flags & (RTF_ADDRCONF | RTF_DYNAMIC)) == 0;
71+
return (rt->rt6i_flags & (RTF_GATEWAY|RTF_ADDRCONF|RTF_DYNAMIC)) ==
72+
RTF_GATEWAY;
7273
}
7374

7475
void ip6_route_input(struct sk_buff *skb);

net/ipv6/ip6_fib.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -934,6 +934,9 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
934934
* list.
935935
* Only static routes (which don't have flag
936936
* RTF_EXPIRES) are used for ECMPv6.
937+
*
938+
* To avoid long list, we only had siblings if the
939+
* route have a gateway.
937940
*/
938941
if (rt_can_ecmp &&
939942
rt6_qualify_for_ecmp(iter))

0 commit comments

Comments
 (0)