netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* question on ipv6 support for duplicate nexthops
@ 2014-06-25 21:40 Roopa Prabhu
  2014-06-27  7:15 ` Hannes Frederic Sowa
  0 siblings, 1 reply; 2+ messages in thread
From: Roopa Prabhu @ 2014-06-25 21:40 UTC (permalink / raw)
  To: netdev; +Cc: Daniel Walton

ipv4 allows duplicate nexthops. Multiple instances of same
  nexthops maybe used to give higher weights to some nexthops
(though the "weight" attribute can be used for the same purpose).

ipv6 does not seem to support duplicate nexthops.

Example: The below ipv6 route is rejected by the kernel
#ip -6 route add 2001:10:1:3::/64 nexthop via 2001:10:1:2::99 nexthop 
via 2001:10:1:2::99

The below patch points to the code that is preventing the addition of 
duplicate nexthops.

I am not sure yet if there are other side effects to the patch below.
If there is interest in making ipv6 consistent with ipv4 for duplicate 
nexthop handling, i can submit a patch.


diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
index cb4459b..afecc87 100644
--- a/net/ipv6/ip6_fib.c
+++ b/net/ipv6/ip6_fib.c
@@ -698,20 +698,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, 
struct rt6_info *rt,
                                 break;
                         }

-                       if (iter->dst.dev == rt->dst.dev &&
-                           iter->rt6i_idev == rt->rt6i_idev &&
- ipv6_addr_equal(&iter->rt6i_gateway,
- &rt->rt6i_gateway)) {
-                               if (rt->rt6i_nsiblings)
-                                       rt->rt6i_nsiblings = 0;
-                               if (!(iter->rt6i_flags & RTF_EXPIRES))
-                                       return -EEXIST;
-                               if (!(rt->rt6i_flags & RTF_EXPIRES))
-                                       rt6_clean_expires(iter);
-                               else
-                                       rt6_set_expires(iter, 
rt->dst.expires);
-                               return -EEXIST;
-                       }
                         /* If we have the same destination and the same 
metric,
                          * but not the same gateway, then the route we 
try to
                          * add is sibling to this route, increment our 
counter

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: question on ipv6 support for duplicate nexthops
  2014-06-25 21:40 question on ipv6 support for duplicate nexthops Roopa Prabhu
@ 2014-06-27  7:15 ` Hannes Frederic Sowa
  0 siblings, 0 replies; 2+ messages in thread
From: Hannes Frederic Sowa @ 2014-06-27  7:15 UTC (permalink / raw)
  To: Roopa Prabhu; +Cc: netdev, Daniel Walton

On Mi, 2014-06-25 at 14:40 -0700, Roopa Prabhu wrote:
> ipv4 allows duplicate nexthops. Multiple instances of same
>   nexthops maybe used to give higher weights to some nexthops
> (though the "weight" attribute can be used for the same purpose).
> 
> ipv6 does not seem to support duplicate nexthops.
> 
> Example: The below ipv6 route is rejected by the kernel
> #ip -6 route add 2001:10:1:3::/64 nexthop via 2001:10:1:2::99 nexthop 
> via 2001:10:1:2::99
> 
> The below patch points to the code that is preventing the addition of 
> duplicate nexthops.
> 
> I am not sure yet if there are other side effects to the patch below.
> If there is interest in making ipv6 consistent with ipv4 for duplicate 
> nexthop handling, i can submit a patch.

ECMP routes are normal routing entries in the fib, just hold together
via an internal list and thus behave differently than IPv4 ECMP routes.

I don't see that just removing the check for duplicate entries will make
that work correctly.

Also you remove some pretty important expire update code.

Bye,
Hannes

> diff --git a/net/ipv6/ip6_fib.c b/net/ipv6/ip6_fib.c
> index cb4459b..afecc87 100644
> --- a/net/ipv6/ip6_fib.c
> +++ b/net/ipv6/ip6_fib.c
> @@ -698,20 +698,6 @@ static int fib6_add_rt2node(struct fib6_node *fn, 
> struct rt6_info *rt,
>                                  break;
>                          }
> 
> -                       if (iter->dst.dev == rt->dst.dev &&
> -                           iter->rt6i_idev == rt->rt6i_idev &&
> - ipv6_addr_equal(&iter->rt6i_gateway,
> - &rt->rt6i_gateway)) {
> -                               if (rt->rt6i_nsiblings)
> -                                       rt->rt6i_nsiblings = 0;
> -                               if (!(iter->rt6i_flags & RTF_EXPIRES))
> -                                       return -EEXIST;
> -                               if (!(rt->rt6i_flags & RTF_EXPIRES))
> -                                       rt6_clean_expires(iter);
> -                               else
> -                                       rt6_set_expires(iter, 
> rt->dst.expires);
> -                               return -EEXIST;
> -                       }
>                          /* If we have the same destination and the same 
> metric,
>                           * but not the same gateway, then the route we 
> try to
>                           * add is sibling to this route, increment our 
> counter
> 
> --
> To unsubscribe from this list: send the line "unsubscribe netdev" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-06-27  7:15 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-25 21:40 question on ipv6 support for duplicate nexthops Roopa Prabhu
2014-06-27  7:15 ` Hannes Frederic Sowa

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).