From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.1 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_PASS,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C7E13C43381 for ; Thu, 21 Mar 2019 12:21:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 99178218D8 for ; Thu, 21 Mar 2019 12:21:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553170899; bh=AoWQl/ctF0vFym5S7Q7XQy76rdb7qANLLPP6hedLcn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=QYJKrfwgZNeglFVdd8sBMwjJNA7bNkJuz2EcGg5H5+S2NKngW2p9DRdNkYrlVvD7L uLY36vV7a0p1tEzNgiiZqoLZktgmEKb/2TFyJXF7s7O+ewBvCvwiBZjvKl5fhQ1ZCx Cg2v5UPjXChzFpexCnexO2FtOy1naMNe2jksJlvI= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728072AbfCUMVi (ORCPT ); Thu, 21 Mar 2019 08:21:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:48592 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727823AbfCUMVh (ORCPT ); Thu, 21 Mar 2019 08:21:37 -0400 Received: from kenny.it.cumulusnetworks.com. (fw.cumulusnetworks.com [216.129.126.126]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id D8B4021915; Thu, 21 Mar 2019 12:21:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1553170896; bh=AoWQl/ctF0vFym5S7Q7XQy76rdb7qANLLPP6hedLcn8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=afoIFuaBpJkyc/rIp89jQ8AgI+1iyW7qkh6d246EczOXYrgSnHptu5jT06pK5imlz bErcCgY3KWTNc+9gkbEi8IfLwTgPFUltlmFTJchBaBL5r7MzTyZbIDCEeZ3iKJ6wE4 izpTKyBRAXrA1UODFqUvr2IRpT0kOQ5iSBKO5wzg= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: David Ahern Subject: [PATCH net-next 1/2] ipv6: Move setting default metric for routes Date: Thu, 21 Mar 2019 05:21:34 -0700 Message-Id: <20190321122135.5768-2-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190321122135.5768-1-dsahern@kernel.org> References: <20190321122135.5768-1-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Ahern ip6_route_info_create is a low level function for ensuring fc_metric is set. Move the check and default setting to the 2 locations that do not already set fc_metric before calling ip6_route_info_create. This is required for the next patch which moves addrconf allocations to ip6_route_info_create and want the metric for host routes to be 0. Signed-off-by: David Ahern --- net/ipv6/route.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/net/ipv6/route.c b/net/ipv6/route.c index c9a2f0f2dea6..d52f215870e2 100644 --- a/net/ipv6/route.c +++ b/net/ipv6/route.c @@ -2950,9 +2950,6 @@ static struct fib6_info *ip6_route_info_create(struct fib6_config *cfg, goto out; } - if (cfg->fc_metric == 0) - cfg->fc_metric = IP6_RT_PRIO_USER; - if (cfg->fc_flags & RTNH_F_ONLINK) { if (!dev) { NL_SET_ERR_MSG(extack, @@ -3603,7 +3600,7 @@ static void rtmsg_to_fib6_config(struct net *net, .fc_table = l3mdev_fib_table_by_index(net, rtmsg->rtmsg_ifindex) ? : RT6_TABLE_MAIN, .fc_ifindex = rtmsg->rtmsg_ifindex, - .fc_metric = rtmsg->rtmsg_metric, + .fc_metric = rtmsg->rtmsg_metric ? : IP6_RT_PRIO_USER, .fc_expires = rtmsg->rtmsg_info, .fc_dst_len = rtmsg->rtmsg_dst_len, .fc_src_len = rtmsg->rtmsg_src_len, @@ -4523,6 +4520,9 @@ static int inet6_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh, if (err < 0) return err; + if (cfg.fc_metric == 0) + cfg.fc_metric = IP6_RT_PRIO_USER; + if (cfg.fc_mp) return ip6_route_multipath_add(&cfg, extack); else -- 2.11.0