From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ido Schimmel Subject: [PATCH net-next 06/18] ipv6: Set nexthop flags during route creation Date: Sun, 7 Jan 2018 12:45:06 +0200 Message-ID: <20180107104518.31693-7-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 S1752827AbeAGKq5 (ORCPT ); Sun, 7 Jan 2018 05:46:57 -0500 In-Reply-To: <20180107104518.31693-1-idosch@mellanox.com> Sender: netdev-owner@vger.kernel.org List-ID: It is valid to install routes with a nexthop device that does not have a carrier, so we need to make sure they're marked accordingly. As explained in the previous patch, host and anycast routes are never marked with the 'linkdown' flag. Note that reject routes are unaffected, as these use the loopback device which always has a carrier. Signed-off-by: Ido Schimmel --- net/ipv6/route.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index 2fd36c7dd143..314e3bf41f6f 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -2746,6 +2746,9 @@ static struct rt6_info *ip6_route_info_create(struct fib6_config *cfg, rt->rt6i_flags = cfg->fc_flags; install_route: + if (!(rt->rt6i_flags & (RTF_LOCAL | RTF_ANYCAST)) && + !netif_carrier_ok(dev)) + rt->rt6i_nh_flags |= RTNH_F_LINKDOWN; rt->dst.dev = dev; rt->rt6i_idev = idev; rt->rt6i_table = table; -- 2.14.3