From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Schimmel Subject: [PATCH net-next 02/18] ipv6: Mark dead nexthops with appropriate flags Date: Sun, 7 Jan 2018 12:45:02 +0200 Message-ID: <20180107104518.31693-3-idosch@mellanox.com> References: <20180107104518.31693-1-idosch@mellanox.com> Mime-Version: 1.0 Content-Type: text/plain Cc: davem@davemloft.net, dsahern@gmail.com, roopa@cumulusnetworks.com, nicolas.dichtel@6wind.com, weiwan@google.com, kafai@fb.com, yoshfuji@linux-ipv6.org, mlxsw@mellanox.com, Ido Schimmel To: netdev@vger.kernel.org Return-path: Received: from mail-eopbgr00048.outbound.protection.outlook.com ([40.107.0.48]:42941 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753177AbeAGKqr (ORCPT ); Sun, 7 Jan 2018 05:46:47 -0500 In-Reply-To: <20180107104518.31693-1-idosch@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: When a netdev is put administratively down or unregistered all the nexthops using it as their nexthop device should be marked with the 'dead' and 'linkdown' flags. Currently, when a route is dumped its nexthop device is tested and the flags are set accordingly. A similar check is performed during route lookup. Instead, we can simply mark the nexthops based on netdev events and avoid checking the netdev's state during route dump and lookup. Signed-off-by: Ido Schimmel --- net/ipv6/route.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index c557362daa23..f5eda0aeab55 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -3473,8 +3473,10 @@ static int fib6_ifdown(struct rt6_info *rt, void *arg) if (rt->dst.dev == dev && rt != adn->net->ipv6.ip6_null_entry && (rt->rt6i_nsiblings == 0 || netdev_unregistering(dev) || - !rt->rt6i_idev->cnf.ignore_routes_with_linkdown)) + !rt->rt6i_idev->cnf.ignore_routes_with_linkdown)) { + rt->rt6i_nh_flags |= (RTNH_F_DEAD | RTNH_F_LINKDOWN); return -1; + } return 0; } -- 2.14.3