linux/net/core/fib_rules.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * net/core/fib_rules.c		Generic Routing Rules
 *
 * Authors:	Thomas Graf <[email protected]>
 */

#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/list.h>
#include <linux/module.h>
#include <net/net_namespace.h>
#include <net/sock.h>
#include <net/fib_rules.h>
#include <net/ip_tunnels.h>
#include <linux/indirect_call_wrapper.h>

#if defined(CONFIG_IPV6) && defined(CONFIG_IPV6_MULTIPLE_TABLES)
#ifdef CONFIG_IP_MULTIPLE_TABLES
#define INDIRECT_CALL_MT(f, f2, f1, ...)
#else
#define INDIRECT_CALL_MT
#endif
#elif defined(CONFIG_IP_MULTIPLE_TABLES)
#define INDIRECT_CALL_MT
#else
#define INDIRECT_CALL_MT
#endif

static const struct fib_kuid_range fib_kuid_range_unset =;

bool fib_rule_matchall(const struct fib_rule *rule)
{}
EXPORT_SYMBOL_GPL();

int fib_default_rule_add(struct fib_rules_ops *ops,
			 u32 pref, u32 table)
{}
EXPORT_SYMBOL();

static u32 fib_default_rule_pref(struct fib_rules_ops *ops)
{}

static void notify_rule_change(int event, struct fib_rule *rule,
			       struct fib_rules_ops *ops, struct nlmsghdr *nlh,
			       u32 pid);

static struct fib_rules_ops *lookup_rules_ops(struct net *net, int family)
{}

static void rules_ops_put(struct fib_rules_ops *ops)
{}

static void flush_route_cache(struct fib_rules_ops *ops)
{}

static int __fib_rules_register(struct fib_rules_ops *ops)
{}

struct fib_rules_ops *
fib_rules_register(const struct fib_rules_ops *tmpl, struct net *net)
{}
EXPORT_SYMBOL_GPL();

static void fib_rules_cleanup_ops(struct fib_rules_ops *ops)
{}

void fib_rules_unregister(struct fib_rules_ops *ops)
{}
EXPORT_SYMBOL_GPL();

static int uid_range_set(struct fib_kuid_range *range)
{}

static struct fib_kuid_range nla_get_kuid_range(struct nlattr **tb)
{}

static int nla_put_uid_range(struct sk_buff *skb, struct fib_kuid_range *range)
{}

static int nla_get_port_range(struct nlattr *pattr,
			      struct fib_rule_port_range *port_range)
{}

static int nla_put_port_range(struct sk_buff *skb, int attrtype,
			      struct fib_rule_port_range *range)
{}

static int fib_rule_match(struct fib_rule *rule, struct fib_rules_ops *ops,
			  struct flowi *fl, int flags,
			  struct fib_lookup_arg *arg)
{}

int fib_rules_lookup(struct fib_rules_ops *ops, struct flowi *fl,
		     int flags, struct fib_lookup_arg *arg)
{}
EXPORT_SYMBOL_GPL();

static int call_fib_rule_notifier(struct notifier_block *nb,
				  enum fib_event_type event_type,
				  struct fib_rule *rule, int family,
				  struct netlink_ext_ack *extack)
{}

static int call_fib_rule_notifiers(struct net *net,
				   enum fib_event_type event_type,
				   struct fib_rule *rule,
				   struct fib_rules_ops *ops,
				   struct netlink_ext_ack *extack)
{}

/* Called with rcu_read_lock() */
int fib_rules_dump(struct net *net, struct notifier_block *nb, int family,
		   struct netlink_ext_ack *extack)
{}
EXPORT_SYMBOL_GPL();

unsigned int fib_rules_seq_read(struct net *net, int family)
{}
EXPORT_SYMBOL_GPL();

static struct fib_rule *rule_find(struct fib_rules_ops *ops,
				  struct fib_rule_hdr *frh,
				  struct nlattr **tb,
				  struct fib_rule *rule,
				  bool user_priority)
{}

#ifdef CONFIG_NET_L3_MASTER_DEV
static int fib_nl2rule_l3mdev(struct nlattr *nla, struct fib_rule *nlrule,
			      struct netlink_ext_ack *extack)
{}
#else
static int fib_nl2rule_l3mdev(struct nlattr *nla, struct fib_rule *nlrule,
			      struct netlink_ext_ack *extack)
{
	NL_SET_ERR_MSG(extack, "l3mdev support is not enabled in kernel");
	return -1;
}
#endif

static int fib_nl2rule(struct sk_buff *skb, struct nlmsghdr *nlh,
		       struct netlink_ext_ack *extack,
		       struct fib_rules_ops *ops,
		       struct nlattr *tb[],
		       struct fib_rule **rule,
		       bool *user_priority)
{}

static int rule_exists(struct fib_rules_ops *ops, struct fib_rule_hdr *frh,
		       struct nlattr **tb, struct fib_rule *rule)
{}

static const struct nla_policy fib_rule_policy[FRA_MAX + 1] =;

int fib_nl_newrule(struct sk_buff *skb, struct nlmsghdr *nlh,
		   struct netlink_ext_ack *extack)
{}
EXPORT_SYMBOL_GPL();

int fib_nl_delrule(struct sk_buff *skb, struct nlmsghdr *nlh,
		   struct netlink_ext_ack *extack)
{}
EXPORT_SYMBOL_GPL();

static inline size_t fib_rule_nlmsg_size(struct fib_rules_ops *ops,
					 struct fib_rule *rule)
{}

static int fib_nl_fill_rule(struct sk_buff *skb, struct fib_rule *rule,
			    u32 pid, u32 seq, int type, int flags,
			    struct fib_rules_ops *ops)
{}

static int dump_rules(struct sk_buff *skb, struct netlink_callback *cb,
		      struct fib_rules_ops *ops)
{}

static int fib_valid_dumprule_req(const struct nlmsghdr *nlh,
				   struct netlink_ext_ack *extack)
{}

static int fib_nl_dumprule(struct sk_buff *skb, struct netlink_callback *cb)
{}

static void notify_rule_change(int event, struct fib_rule *rule,
			       struct fib_rules_ops *ops, struct nlmsghdr *nlh,
			       u32 pid)
{}

static void attach_rules(struct list_head *rules, struct net_device *dev)
{}

static void detach_rules(struct list_head *rules, struct net_device *dev)
{}


static int fib_rules_event(struct notifier_block *this, unsigned long event,
			   void *ptr)
{}

static struct notifier_block fib_rules_notifier =;

static int __net_init fib_rules_net_init(struct net *net)
{}

static void __net_exit fib_rules_net_exit(struct net *net)
{}

static struct pernet_operations fib_rules_net_ops =;

static int __init fib_rules_init(void)
{}

subsys_initcall(fib_rules_init);