diff mbox series

ipv6: Do not consider linkdown nexthops during multipath

Message ID 258c4c3dc9fcde5b62e59c14f155917adaccf692.1513269290.git.joseph.salisbury@canonical.com
State New
Headers show
Series ipv6: Do not consider linkdown nexthops during multipath | expand

Commit Message

Joseph Salisbury Dec. 15, 2017, 2:40 p.m. UTC
From: Ido Schimmel <idosch@mellanox.com>

BugLink: http://bugs.launchpad.net/bugs/1738219

When the 'ignore_routes_with_linkdown' sysctl is set, we should not
consider linkdown nexthops during route lookup.

While the code correctly verifies that the initially selected route
('match') has a carrier, it does not perform the same check in the
subsequent multipath selection, resulting in a potential packet loss.

In case the chosen route does not have a carrier and the sysctl is set,
choose the initially selected route.

Fixes: 35103d11173b ("net: ipv6 sysctl option to ignore routes when nexthop link is down")
Signed-off-by: Ido Schimmel <idosch@mellanox.com>
Acked-by: David Ahern <dsahern@gmail.com>
Acked-by: Andy Gospodarek <andy@greyhouse.net>
Signed-off-by: David S. Miller <davem@davemloft.net>
(cherry picked from commit bbfcd77631573ac4a9f57eb6169e04256a111bc1)
Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
---
 net/ipv6/route.c | 5 +++++
 1 file changed, 5 insertions(+)

Comments

Stefan Bader Jan. 23, 2018, 1:53 p.m. UTC | #1
On 15.12.2017 15:40, Joseph Salisbury wrote:
> From: Ido Schimmel <idosch@mellanox.com>
> 
> BugLink: http://bugs.launchpad.net/bugs/1738219
> 
> When the 'ignore_routes_with_linkdown' sysctl is set, we should not
> consider linkdown nexthops during route lookup.
> 
> While the code correctly verifies that the initially selected route
> ('match') has a carrier, it does not perform the same check in the
> subsequent multipath selection, resulting in a potential packet loss.
> 
> In case the chosen route does not have a carrier and the sysctl is set,
> choose the initially selected route.
> 
> Fixes: 35103d11173b ("net: ipv6 sysctl option to ignore routes when nexthop link is down")
> Signed-off-by: Ido Schimmel <idosch@mellanox.com>
> Acked-by: David Ahern <dsahern@gmail.com>
> Acked-by: Andy Gospodarek <andy@greyhouse.net>
> Signed-off-by: David S. Miller <davem@davemloft.net>
> (cherry picked from commit bbfcd77631573ac4a9f57eb6169e04256a111bc1)
> Signed-off-by: Joseph Salisbury <joseph.salisbury@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>

> ---
>  net/ipv6/route.c | 5 +++++
>  1 file changed, 5 insertions(+)
> 
> diff --git a/net/ipv6/route.c b/net/ipv6/route.c
> index 09f2644..6e09bd4 100644
> --- a/net/ipv6/route.c
> +++ b/net/ipv6/route.c
> @@ -465,6 +465,11 @@ static struct rt6_info *rt6_multipath_select(struct rt6_info *match,
>  				&match->rt6i_siblings, rt6i_siblings) {
>  			route_choosen--;
>  			if (route_choosen == 0) {
> +				struct inet6_dev *idev = sibling->rt6i_idev;
> +
> +				if (!netif_carrier_ok(sibling->dst.dev) &&
> +				    idev->cnf.ignore_routes_with_linkdown)
> +					break;
>  				if (rt6_score_route(sibling, oif, strict) < 0)
>  					break;
>  				match = sibling;
>
diff mbox series

Patch

diff --git a/net/ipv6/route.c b/net/ipv6/route.c
index 09f2644..6e09bd4 100644
--- a/net/ipv6/route.c
+++ b/net/ipv6/route.c
@@ -465,6 +465,11 @@  static struct rt6_info *rt6_multipath_select(struct rt6_info *match,
 				&match->rt6i_siblings, rt6i_siblings) {
 			route_choosen--;
 			if (route_choosen == 0) {
+				struct inet6_dev *idev = sibling->rt6i_idev;
+
+				if (!netif_carrier_ok(sibling->dst.dev) &&
+				    idev->cnf.ignore_routes_with_linkdown)
+					break;
 				if (rt6_score_route(sibling, oif, strict) < 0)
 					break;
 				match = sibling;