Skip to content

Commit

Permalink
ipv6: Revert "ipv6: Allow non-gateway ECMP for IPv6"
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
idosch authored and davem330 committed May 2, 2018
1 parent 784813a commit 30ca22e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
3 changes: 2 additions & 1 deletion include/net/ip6_route.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
3 changes: 3 additions & 0 deletions net/ipv6/ip6_fib.c
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down

0 comments on commit 30ca22e

Please sign in to comment.