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);
 
        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
                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)