Skip to contentSkip to conversation

net/ipv6: Revert attempt to simplify route replace and append

PATCH Superseded [email protected] 4 participants 6 messages Jul 2, 2018 – Jul 5, 2018

Subsystems (4)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore

[email protected]

author maintainer
#0 lore raw

PATCH 1/1 net/ipv6: Revert attempt to simplify route replace and append

From: David Ahern <[email protected]>

NetworkManager likes to manage linklocal prefix routes and does so with the NLM_F_APPEND flag, breaking attempts to simplify the IPv6 route code and by extension enable multipath routes with device only nexthops.

Revert f34436a43092 and its followup
6eba08c3626b ("ipv6: Only emit append events for appended routes"). Update the test cases to reflect the old behavior.

Fixes f34436a43092 ("net/ipv6: Simplify route replace and appending into multipath route")

---
Ido: I left 5a15a1b07c51. FIB_EVENT_ENTRY_APPEND is not generated for
IPv6, so no harm in leaving it.

 include/net/ip6_route.h                  |   6 ++
 net/ipv6/ip6_fib.c                       | 156 +++++++++++++++++--------------
 net/ipv6/route.c                         |   3 +-
 tools/testing/selftests/net/fib_tests.sh |  41 --------
 4 files changed, 93 insertions(+), 113 deletions(-)
include/net/ip6_route.h +6 -0
index 59656fc580df..7b9c82de11cc 100644
@@ -66,6 +66,12 @@ static inline bool rt6_need_strict(const struct in6_addr *daddr)
 		(IPV6_ADDR_MULTICAST | IPV6_ADDR_LINKLOCAL | IPV6_ADDR_LOOPBACK);
 }
 
+static inline bool rt6_qualify_for_ecmp(const struct fib6_info *f6i)
+{
+	return (f6i->fib6_flags & (RTF_GATEWAY|RTF_ADDRCONF|RTF_DYNAMIC)) ==
+	       RTF_GATEWAY;
+}
+
 void ip6_route_input(struct sk_buff *skb);
 struct dst_entry *ip6_route_input_lookup(struct net *net,
 					 struct net_device *dev,
net/ipv6/ip6_fib.c +86 -70

237 lines not on this page · raw message

net/ipv6/route.c +1 -2
index 86a0e4333d42..63f99411f0de 100644
@@ -3842,7 +3842,7 @@ static struct fib6_info *rt6_multipath_first_sibling(const struct fib6_info *rt)
 			lockdep_is_held(&rt->fib6_table->tb6_lock));
 	while (iter) {
 		if (iter->fib6_metric == rt->fib6_metric &&
-		    iter->fib6_nsiblings)
+		    rt6_qualify_for_ecmp(iter))
 			return iter;
 		iter = rcu_dereference_protected(iter->fib6_next,
 				lockdep_is_held(&rt->fib6_table->tb6_lock));
@@ -4439,7 +4439,6 @@ static int ip6_route_multipath_add(struct fib6_config *cfg,
 		 */
 		cfg->fc_nlinfo.nlh->nlmsg_flags &= ~(NLM_F_EXCL |
 						     NLM_F_REPLACE);
-		cfg->fc_nlinfo.nlh->nlmsg_flags |= NLM_F_APPEND;
 		nhn++;
 	}
 
tools/testing/selftests/net/fib_tests.sh +0 -41

65 lines not on this page · raw message

Signature · 1 line
2.11.0
#1 lore raw
Quoted 10 lines · On Mon, Jul 02, 2018 at 03:03:12PM -0700, [email protected] wrote:

From: David Ahern <[email protected]>

NetworkManager likes to manage linklocal prefix routes and does so with the NLM_F_APPEND flag, breaking attempts to simplify the IPv6 route code and by extension enable multipath routes with device only nexthops.

Revert f34436a43092 and its followup
6eba08c3626b ("ipv6: Only emit append events for appended routes"). Update the test cases to reflect the old behavior.

Quoted 5 lines
Fixes f34436a43092 ("net/ipv6: Simplify route replace and appending into multipath route")

---
Ido: I left 5a15a1b07c51. FIB_EVENT_ENTRY_APPEND is not generated for
IPv6, so no harm in leaving it.

OK, but I had a follow-up series that did further changes in mlxsw (merge commit eab9a2d5f323) to support the new behavior. You want to revert it and squash to v2 or I'll send another revert?

Also, Petr added a multipath test that relies on IPv6 device only nexthops. See commit 54818c4c4b937.

#2 lore raw
Quoted 17 lines · Ido Schimmel
Quoted 10 lines · On Mon, Jul 02, 2018 at 03:03:12PM -0700, [email protected] wrote:

From: David Ahern <[email protected]>

NetworkManager likes to manage linklocal prefix routes and does so with the NLM_F_APPEND flag, breaking attempts to simplify the IPv6 route code and by extension enable multipath routes with device only nexthops.

Revert f34436a43092 and its followup
6eba08c3626b ("ipv6: Only emit append events for appended routes"). Update the test cases to reflect the old behavior.

Quoted 5 lines
Fixes f34436a43092 ("net/ipv6: Simplify route replace and appending into multipath route")

---
Ido: I left 5a15a1b07c51. FIB_EVENT_ENTRY_APPEND is not generated for
IPv6, so no harm in leaving it.

Quoted 3 lines

OK, but I had a follow-up series that did further changes in mlxsw (merge commit eab9a2d5f323) to support the new behavior. You want to revert it and squash to v2 or I'll send another revert?

I'll squash. The ability to add dev only nexthops is clearly needed. Reverting in 1 patch will help on the next attempt.

It is unfortunate that mlxsw has to replicate the node lookup code.

Quoted 4 lines

Also, Petr added a multipath test that relies on IPv6 device only nexthops. See commit 54818c4c4b937.

ok. I'll remove the ipv6 mpath tests as well.

#3 lore raw
Quoted 1 line · David Ahern

It is unfortunate that mlxsw has to replicate the node lookup code.

The kernel can store multiple routes with the same prefix/length, but only one is used for forwarding. Thus when a route is deleted it should be potentially overwritten by a different route in the device's tables. This is why mlxsw stores these nodes.

We can have the IPv4/IPv6 code only generate a REPLACE / DELETE notification for routes that are actually used for forwarding and relieve listeners from the need to implement this logic themselves. I think this should work.

?

maintainer
#4 lore raw

From: Ido Schimmel <[email protected]>
Date: Thu, 5 Jul 2018 00:10:41 +0300

Quoted 4 lines

We can have the IPv4/IPv6 code only generate a REPLACE / DELETE notification for routes that are actually used for forwarding and relieve listeners from the need to implement this logic themselves. I think this should work.

Whilst this could reduce the duplication, I worry that in the long term that this might end up being error prone.

Just my $0.02

#5 lore raw
Quoted 11 lines · David Miller

From: Ido Schimmel <[email protected]>
Date: Thu, 5 Jul 2018 00:10:41 +0300

Quoted 4 lines

We can have the IPv4/IPv6 code only generate a REPLACE / DELETE notification for routes that are actually used for forwarding and relieve listeners from the need to implement this logic themselves. I think this should work.

Whilst this could reduce the duplication, I worry that in the long term that this might end up being error prone.

Duplication of data and duplication of logic is not ideal. Especially in this case where the duplication of both is only to handle one case - duplicate routes where only the first is programmed. I suspect it will have to be dealt with at some point (e.g., scaling to a million routes), but right now there are more important factors to deal with - like the rtnl_lock. Something to keep in mind for the future.