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_HELO_NONE,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 9ABBCC282CE for ; Wed, 22 May 2019 19:05:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7045020862 for ; Wed, 22 May 2019 19:05:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558551915; bh=NHYwx/lArxHWha4AoCpgHlXLpISiIEpclrFvtMtsAU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:List-ID:From; b=irn/ipsNc0Jo4sAdttqUVTrIjj084jWUoDCFWPW29+YtDbbyyuVNnZqRyVST6O3ia rpGbxAb0O5XJBPVoLEPnOlHkz1tjkMmsrgex+XVpdoD9fcBiZI+Lrhefe3R73kk9Tm +wVatSEmgawruCgVRmTAwWdyv4nk9Ivy6bMkx1Ls= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729753AbfEVTFK (ORCPT ); Wed, 22 May 2019 15:05:10 -0400 Received: from mail.kernel.org ([198.145.29.99]:35044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729538AbfEVTE6 (ORCPT ); Wed, 22 May 2019 15:04:58 -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 2F15F217D4; Wed, 22 May 2019 19:04:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1558551898; bh=NHYwx/lArxHWha4AoCpgHlXLpISiIEpclrFvtMtsAU4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=z1FKl7WvxS2vO46xLVeSmwDinRuTMHVCXIZqLjKuQmpMVrmws7HuwnpSePtOfwtt9 lo1OOoX1+WuJFo3WVQ8V0iPEK66x371eXdrq5eTRHZi0LXvhWTeKdi9KM+XmXF7wG4 Dxi0HCVWQ/HjcgaBa3CvVLibokCyvWcwFADX+peE= From: David Ahern To: davem@davemloft.net, netdev@vger.kernel.org Cc: idosch@mellanox.com, David Ahern Subject: [PATCH v2 net-next 5/8] ipv4: export fib_check_nh Date: Wed, 22 May 2019 12:04:43 -0700 Message-Id: <20190522190446.15486-6-dsahern@kernel.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190522190446.15486-1-dsahern@kernel.org> References: <20190522190446.15486-1-dsahern@kernel.org> Sender: netdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: netdev@vger.kernel.org From: David Ahern Change fib_check_nh to take net, table and scope as input arguments over struct fib_config and export for use by nexthop code. Signed-off-by: David Ahern --- include/net/ip_fib.h | 2 ++ net/ipv4/fib_semantics.c | 12 ++++++------ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/include/net/ip_fib.h b/include/net/ip_fib.h index ec6496c08f48..27d7c89ca9c4 100644 --- a/include/net/ip_fib.h +++ b/include/net/ip_fib.h @@ -436,6 +436,8 @@ void fib_sync_mtu(struct net_device *dev, u32 orig_mtu); int fib_multipath_hash(const struct net *net, const struct flowi4 *fl4, const struct sk_buff *skb, struct flow_keys *flkeys); #endif +int fib_check_nh(struct net *net, struct fib_nh *nh, u32 table, u8 scope, + struct netlink_ext_ack *extack); void fib_select_multipath(struct fib_result *res, int hash); void fib_select_path(struct net *net, struct fib_result *res, struct flowi4 *fl4, const struct sk_buff *skb); diff --git a/net/ipv4/fib_semantics.c b/net/ipv4/fib_semantics.c index d3da6a10f86f..4541121426fb 100644 --- a/net/ipv4/fib_semantics.c +++ b/net/ipv4/fib_semantics.c @@ -1092,15 +1092,13 @@ static int fib_check_nh_nongw(struct net *net, struct fib_nh *nh, return err; } -static int fib_check_nh(struct fib_config *cfg, struct fib_nh *nh, - struct netlink_ext_ack *extack) +int fib_check_nh(struct net *net, struct fib_nh *nh, u32 table, u8 scope, + struct netlink_ext_ack *extack) { - struct net *net = cfg->fc_nlinfo.nl_net; - u32 table = cfg->fc_table; int err; if (nh->fib_nh_gw_family == AF_INET) - err = fib_check_nh_v4_gw(net, nh, table, cfg->fc_scope, extack); + err = fib_check_nh_v4_gw(net, nh, table, scope, extack); else if (nh->fib_nh_gw_family == AF_INET6) err = fib_check_nh_v6_gw(net, nh, table, extack); else @@ -1377,7 +1375,9 @@ struct fib_info *fib_create_info(struct fib_config *cfg, int linkdown = 0; change_nexthops(fi) { - err = fib_check_nh(cfg, nexthop_nh, extack); + err = fib_check_nh(cfg->fc_nlinfo.nl_net, nexthop_nh, + cfg->fc_table, cfg->fc_scope, + extack); if (err != 0) goto failure; if (nexthop_nh->fib_nh_flags & RTNH_F_LINKDOWN) -- 2.11.0