/* * vrf.c: device driver to encapsulate a VRF space * * Copyright (c) 2015 Cumulus Networks. All rights reserved. * Copyright (c) 2015 Shrijeet Mukherjee <shm@cumulusnetworks.com> * Copyright (c) 2015 David Ahern <dsa@cumulusnetworks.com> * * Based on dummy, team and ipvlan drivers * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. */#include<linux/module.h>#include<linux/kernel.h>#include<linux/netdevice.h>#include<linux/etherdevice.h>#include<linux/ip.h>#include<linux/init.h>#include<linux/moduleparam.h>#include<linux/netfilter.h>#include<linux/rtnetlink.h>#include<net/rtnetlink.h>#include<linux/u64_stats_sync.h>#include<linux/hashtable.h>#include<linux/inetdevice.h>#include<net/arp.h>#include<net/ip.h>#include<net/ip_fib.h>#include<net/ip6_fib.h>#include<net/ip6_route.h>#include<net/route.h>#include<net/addrconf.h>#include<net/l3mdev.h>#include<net/fib_rules.h>#include<net/netns/generic.h>#define DRV_NAME "vrf"#define DRV_VERSION "1.0"#define FIB_RULE_PREF 1000 /* default preference for FIB rules */staticunsignedintvrf_net_id;structnet_vrf{structrtable__rcu*rth;structrt6_info__rcu*rt6;#if IS_ENABLED(CONFIG_IPV6)structfib6_table*fib6_table;#endifu32tb_id;};structpcpu_dstats{u64tx_pkts;u64tx_bytes;u64tx_drps;u64rx_pkts;u64rx_bytes;u64rx_drps;structu64_stats_syncsyncp;}