* [PATCH net] net: ipv6: Compare lwstate in detecting duplicate nexthops
@ 2017-07-05 20:41 David Ahern
2017-07-05 21:14 ` Roopa Prabhu
2017-07-06 9:49 ` David Miller
0 siblings, 2 replies; 4+ messages in thread
From: David Ahern @ 2017-07-05 20:41 UTC (permalink / raw)
To: netdev; +Cc: buytenh, roopa, rshearma, David Ahern
Lennert reported a failure to add different mpls encaps in a multipath
route:
$ ip -6 route add 1234::/16 \
nexthop encap mpls 10 via fe80::1 dev ens3 \
nexthop encap mpls 20 via fe80::1 dev ens3
RTNETLINK answers: File exists
The problem is that the duplicate nexthop detection does not compare
lwtunnel configuration. Add it.
Fixes: 19e42e451506("ipv6: support for fib route lwtunnel encap attributes")
Signed-off-by: David Ahern <dsahern@gmail.com>
---
include/net/ip6_route.h | 8 ++++++++
net/ipv6/ip6_fib.c | 5 +----
net/ipv6/route.c | 8 +-------
3 files changed, 10 insertions(+), 11 deletions(-)
diff --git a/include/net/ip6_route.h b/include/net/ip6_route.h
index f5e625f53367..4341731f39a5 100644
--- a/include/net/ip6_route.h
+++ b/include/net/ip6_route.h
@@ -22,6 +22,7 @@ struct route_info {
#include <net/flow.h>
#include <net/ip6_fib.h>
#include <net/sock.h>
+#include <net/lwtunnel.h>
#include <linux/ip.h>
#include <linux/ipv6.h>
#include <linux/route.h>
@@ -233,4 +234,11 @@ static inline struct in6_addr *rt6_nexthop(struct rt6_info *rt,
return daddr;
}
+static inline bool rt6_duplicate_nexthop(struct rt6_info *a, struct rt6_info *b)
+{
+ return a->dst.dev == b->dst.dev &&
+ a->rt6i_idev == b->rt6i_idev &&
+ ipv6_addr_equal(&a->rt6i_gateway, &b->rt6i_gateway) &&
+ !lwtunnel_cmp_encap(a->dst.lwtstate, b->dst.lwtstate);
+}
#endif
diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index e6b78ba0e636..e4e9f752ebbf 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -784,10 +784,7 @@ static int fib6_add_rt2node(struct fib6_node *fn, struct rt6_info *rt,
goto next_iter;
}
- if (iter->dst.dev == rt->dst.dev &&
- iter->rt6i_idev == rt->rt6i_idev &&
- ipv6_addr_equal(&iter->rt6i_gateway,
- &rt->rt6i_gateway)) {
+ if (rt6_duplicate_nexthop(iter, rt)) {
if (rt->rt6i_nsiblings)
rt->rt6i_nsiblings = 0;
if (!(iter->rt6i_flags & RTF_EXPIRES))
diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 322bd62e688b..bc49f9a82994 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -3048,17 +3048,11 @@ static int ip6_route_info_append(struct list_head *rt6_nh_list,
struct rt6_info *rt, struct fib6_config *r_cfg)
{
struct rt6_nh *nh;
- struct rt6_info *rtnh;
int err = -EEXIST;
list_for_each_entry(nh, rt6_nh_list, next) {
/* check if rt6_info already exists */
- rtnh = nh->rt6_info;
-
- if (rtnh->dst.dev == rt->dst.dev &&
- rtnh->rt6i_idev == rt->rt6i_idev &&
- ipv6_addr_equal(&rtnh->rt6i_gateway,
- &rt->rt6i_gateway))
+ if (rt6_duplicate_nexthop(nh->rt6_info, rt))
return err;
}
--
2.11.0 (Apple Git-81)
^ permalink raw reply related [flat|nested] 4+ messages in thread* Re: [PATCH net] net: ipv6: Compare lwstate in detecting duplicate nexthops
2017-07-05 20:41 [PATCH net] net: ipv6: Compare lwstate in detecting duplicate nexthops David Ahern
@ 2017-07-05 21:14 ` Roopa Prabhu
2017-07-05 21:38 ` Lennert Buytenhek
2017-07-06 9:49 ` David Miller
1 sibling, 1 reply; 4+ messages in thread
From: Roopa Prabhu @ 2017-07-05 21:14 UTC (permalink / raw)
To: David Ahern; +Cc: netdev@vger.kernel.org, Lennert Buytenhek, Robert Shearman
On Wed, Jul 5, 2017 at 1:41 PM, David Ahern <dsahern@gmail.com> wrote:
> Lennert reported a failure to add different mpls encaps in a multipath
> route:
>
> $ ip -6 route add 1234::/16 \
> nexthop encap mpls 10 via fe80::1 dev ens3 \
> nexthop encap mpls 20 via fe80::1 dev ens3
> RTNETLINK answers: File exists
>
> The problem is that the duplicate nexthop detection does not compare
> lwtunnel configuration. Add it.
>
> Fixes: 19e42e451506("ipv6: support for fib route lwtunnel encap attributes")
> Signed-off-by: David Ahern <dsahern@gmail.com>
> ---
Reported-by: João Taveira Araújo <joao.taveira@gmail.com>
Reported-by: Lennert Buytenhek <buytenh@wantstofly.org>
Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
^ permalink raw reply [flat|nested] 4+ messages in thread* Re: [PATCH net] net: ipv6: Compare lwstate in detecting duplicate nexthops
2017-07-05 21:14 ` Roopa Prabhu
@ 2017-07-05 21:38 ` Lennert Buytenhek
0 siblings, 0 replies; 4+ messages in thread
From: Lennert Buytenhek @ 2017-07-05 21:38 UTC (permalink / raw)
To: David Ahern, Roopa Prabhu; +Cc: netdev@vger.kernel.org, Robert Shearman
On Wed, Jul 05, 2017 at 02:14:33PM -0700, Roopa Prabhu wrote:
> > Lennert reported a failure to add different mpls encaps in a multipath
> > route:
> >
> > $ ip -6 route add 1234::/16 \
> > nexthop encap mpls 10 via fe80::1 dev ens3 \
> > nexthop encap mpls 20 via fe80::1 dev ens3
> > RTNETLINK answers: File exists
> >
> > The problem is that the duplicate nexthop detection does not compare
> > lwtunnel configuration. Add it.
> >
> > Fixes: 19e42e451506("ipv6: support for fib route lwtunnel encap attributes")
> > Signed-off-by: David Ahern <dsahern@gmail.com>
>
> Reported-by: João Taveira Araújo <joao.taveira@gmail.com>
>
> Reported-by: Lennert Buytenhek <buytenh@wantstofly.org>
>
> Acked-by: Roopa Prabhu <roopa@cumulusnetworks.com>
Tested-by: Lennert Buytenhek <buytenh@wantstofly.org>
Seems to work! Thanks!
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net] net: ipv6: Compare lwstate in detecting duplicate nexthops
2017-07-05 20:41 [PATCH net] net: ipv6: Compare lwstate in detecting duplicate nexthops David Ahern
2017-07-05 21:14 ` Roopa Prabhu
@ 2017-07-06 9:49 ` David Miller
1 sibling, 0 replies; 4+ messages in thread
From: David Miller @ 2017-07-06 9:49 UTC (permalink / raw)
To: dsahern; +Cc: netdev, buytenh, roopa, rshearma
From: David Ahern <dsahern@gmail.com>
Date: Wed, 5 Jul 2017 14:41:46 -0600
> Lennert reported a failure to add different mpls encaps in a multipath
> route:
>
> $ ip -6 route add 1234::/16 \
> nexthop encap mpls 10 via fe80::1 dev ens3 \
> nexthop encap mpls 20 via fe80::1 dev ens3
> RTNETLINK answers: File exists
>
> The problem is that the duplicate nexthop detection does not compare
> lwtunnel configuration. Add it.
>
> Fixes: 19e42e451506("ipv6: support for fib route lwtunnel encap attributes")
> Signed-off-by: David Ahern <dsahern@gmail.com>
Applied and queued up for -stable, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-07-06 9:49 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-07-05 20:41 [PATCH net] net: ipv6: Compare lwstate in detecting duplicate nexthops David Ahern
2017-07-05 21:14 ` Roopa Prabhu
2017-07-05 21:38 ` Lennert Buytenhek
2017-07-06 9:49 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).