#include <linux/module.h>
#include <linux/uaccess.h>
#include <linux/bitops.h>
#include <linux/capability.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/mm.h>
#include <linux/string.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/errno.h>
#include <linux/in.h>
#include <linux/inet.h>
#include <linux/inetdevice.h>
#include <linux/netdevice.h>
#include <linux/if_addr.h>
#include <linux/if_arp.h>
#include <linux/skbuff.h>
#include <linux/cache.h>
#include <linux/init.h>
#include <linux/list.h>
#include <linux/slab.h>
#include <net/inet_dscp.h>
#include <net/ip.h>
#include <net/protocol.h>
#include <net/route.h>
#include <net/tcp.h>
#include <net/sock.h>
#include <net/arp.h>
#include <net/ip_fib.h>
#include <net/nexthop.h>
#include <net/rtnetlink.h>
#include <net/xfrm.h>
#include <net/l3mdev.h>
#include <net/lwtunnel.h>
#include <trace/events/fib.h>
#ifndef CONFIG_IP_MULTIPLE_TABLES
static int __net_init fib4_rules_init(struct net *net)
{
struct fib_table *local_table, *main_table;
main_table = fib_trie_table(RT_TABLE_MAIN, NULL);
if (!main_table)
return -ENOMEM;
local_table = fib_trie_table(RT_TABLE_LOCAL, main_table);
if (!local_table)
goto fail;
hlist_add_head_rcu(&local_table->tb_hlist,
&net->ipv4.fib_table_hash[TABLE_LOCAL_INDEX]);
hlist_add_head_rcu(&main_table->tb_hlist,
&net->ipv4.fib_table_hash[TABLE_MAIN_INDEX]);
return 0;
fail:
fib_free_table(main_table);
return -ENOMEM;
}
#else
struct fib_table *fib_new_table(struct net *net, u32 id)
{ … }
EXPORT_SYMBOL_GPL(…);
struct fib_table *fib_get_table(struct net *net, u32 id)
{ … }
#endif
static void fib_replace_table(struct net *net, struct fib_table *old,
struct fib_table *new)
{ … }
int fib_unmerge(struct net *net)
{ … }
void fib_flush(struct net *net)
{ … }
static inline unsigned int __inet_dev_addr_type(struct net *net,
const struct net_device *dev,
__be32 addr, u32 tb_id)
{ … }
unsigned int inet_addr_type_table(struct net *net, __be32 addr, u32 tb_id)
{ … }
EXPORT_SYMBOL(…);
unsigned int inet_addr_type(struct net *net, __be32 addr)
{ … }
EXPORT_SYMBOL(…);
unsigned int inet_dev_addr_type(struct net *net, const struct net_device *dev,
__be32 addr)
{ … }
EXPORT_SYMBOL(…);
unsigned int inet_addr_type_dev_table(struct net *net,
const struct net_device *dev,
__be32 addr)
{ … }
EXPORT_SYMBOL(…);
__be32 fib_compute_spec_dst(struct sk_buff *skb)
{ … }
bool fib_info_nh_uses_dev(struct fib_info *fi, const struct net_device *dev)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
u8 tos, int oif, struct net_device *dev,
int rpf, struct in_device *idev, u32 *itag)
{ … }
int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
u8 tos, int oif, struct net_device *dev,
struct in_device *idev, u32 *itag)
{ … }
static inline __be32 sk_extract_addr(struct sockaddr *addr)
{ … }
static int put_rtax(struct nlattr *mx, int len, int type, u32 value)
{ … }
static int rtentry_to_fib_config(struct net *net, int cmd, struct rtentry *rt,
struct fib_config *cfg)
{ … }
int ip_rt_ioctl(struct net *net, unsigned int cmd, struct rtentry *rt)
{ … }
const struct nla_policy rtm_ipv4_policy[RTA_MAX + 1] = …;
int fib_gw_from_via(struct fib_config *cfg, struct nlattr *nla,
struct netlink_ext_ack *extack)
{ … }
static int rtm_to_fib_config(struct net *net, struct sk_buff *skb,
struct nlmsghdr *nlh, struct fib_config *cfg,
struct netlink_ext_ack *extack)
{ … }
static int inet_rtm_delroute(struct sk_buff *skb, struct nlmsghdr *nlh,
struct netlink_ext_ack *extack)
{ … }
static int inet_rtm_newroute(struct sk_buff *skb, struct nlmsghdr *nlh,
struct netlink_ext_ack *extack)
{ … }
int ip_valid_fib_dump_req(struct net *net, const struct nlmsghdr *nlh,
struct fib_dump_filter *filter,
struct netlink_callback *cb)
{ … }
EXPORT_SYMBOL_GPL(…);
static int inet_dump_fib(struct sk_buff *skb, struct netlink_callback *cb)
{ … }
static void fib_magic(int cmd, int type, __be32 dst, int dst_len,
struct in_ifaddr *ifa, u32 rt_priority)
{ … }
void fib_add_ifaddr(struct in_ifaddr *ifa)
{ … }
void fib_modify_prefix_metric(struct in_ifaddr *ifa, u32 new_metric)
{ … }
void fib_del_ifaddr(struct in_ifaddr *ifa, struct in_ifaddr *iprim)
{ … }
static void nl_fib_lookup(struct net *net, struct fib_result_nl *frn)
{ … }
static void nl_fib_input(struct sk_buff *skb)
{ … }
static int __net_init nl_fib_lookup_init(struct net *net)
{ … }
static void nl_fib_lookup_exit(struct net *net)
{ … }
static void fib_disable_ip(struct net_device *dev, unsigned long event,
bool force)
{ … }
static int fib_inetaddr_event(struct notifier_block *this, unsigned long event, void *ptr)
{ … }
static int fib_netdev_event(struct notifier_block *this, unsigned long event, void *ptr)
{ … }
static struct notifier_block fib_inetaddr_notifier = …;
static struct notifier_block fib_netdev_notifier = …;
static int __net_init ip_fib_net_init(struct net *net)
{ … }
static void ip_fib_net_exit(struct net *net)
{ … }
static int __net_init fib_net_init(struct net *net)
{ … }
static void __net_exit fib_net_exit(struct net *net)
{ … }
static void __net_exit fib_net_exit_batch(struct list_head *net_list)
{ … }
static struct pernet_operations fib_net_ops = …;
void __init ip_fib_init(void)
{ … }