OSDN Git Service

net/ipv6: Simplify route replace and appending into multipath route
authorDavid Ahern <dsahern@gmail.com>
Mon, 21 May 2018 17:26:53 +0000 (10:26 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 22 May 2018 18:44:18 +0000 (14:44 -0400)
commitf34436a430920bdfdba575b509d994c619f5101d
tree26083e7a9e1d09c1c0eab88aca70f2480bfffb49
parent5a15a1b07c51dffcb4c4b6be0f8af1bb964162e0
net/ipv6: Simplify route replace and appending into multipath route

Bring consistency to ipv6 route replace and append semantics.

Remove rt6_qualify_for_ecmp which is just guess work. It fails in 2 cases:
1. can not replace a route with a reject route. Existing code appends
   a new route instead of replacing the existing one.

2. can not have a multipath route where a leg uses a dev only nexthop

Existing use cases affected by this change:
1. adding a route with existing prefix and metric using NLM_F_CREATE
   without NLM_F_APPEND or NLM_F_EXCL (ie., what iproute2 calls
   'prepend'). Existing code auto-determines that the new nexthop can
   be appended to an existing route to create a multipath route. This
   change breaks that by requiring the APPEND flag for the new route
   to be added to an existing one. Instead the prepend just adds another
   route entry.

2. route replace. Existing code replaces first matching multipath route
   if new route is multipath capable and fallback to first matching
   non-ECMP route (reject or dev only route) in case one isn't available.
   New behavior replaces first matching route. (Thanks to Ido for spotting
   this one)

Note: Newer iproute2 is needed to display multipath routes with a dev-only
      nexthop. This is due to a bug in iproute2 and parsing nexthops.

Signed-off-by: David Ahern <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip6_route.h
net/ipv6/ip6_fib.c
net/ipv6/route.c