]> git.baikalelectronics.ru Git - kernel.git/commitdiff
ipv4: export fib_check_nh
authorDavid Ahern <dsahern@gmail.com>
Wed, 22 May 2019 19:04:43 +0000 (12:04 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 23 May 2019 00:48:44 +0000 (17:48 -0700)
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 <dsahern@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/net/ip_fib.h
net/ipv4/fib_semantics.c

index ec6496c08f48237d0a4dd09eedf356be63315ebb..27d7c89ca9c4f866f8a8e601e6b0f2acc9c5c0c9 100644 (file)
@@ -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);
index d3da6a10f86f4b7e0d34b3851862a290c0b33d40..4541121426fb4c0f98963234fe33ef3418cf07e3 100644 (file)
@@ -1092,15 +1092,13 @@ out:
        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)