#define pr_fmt(fmt) …
#include <linux/capability.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/in.h>
#include <linux/tcp.h>
#include <linux/udp.h>
#include <linux/if_arp.h>
#include <linux/if_vlan.h>
#include <linux/init.h>
#include <linux/in6.h>
#include <linux/inetdevice.h>
#include <linux/igmp.h>
#include <linux/netfilter_ipv4.h>
#include <linux/etherdevice.h>
#include <linux/if_ether.h>
#include <net/sock.h>
#include <net/ip.h>
#include <net/icmp.h>
#include <net/protocol.h>
#include <net/ip_tunnels.h>
#include <net/arp.h>
#include <net/checksum.h>
#include <net/dsfield.h>
#include <net/inet_ecn.h>
#include <net/xfrm.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#include <net/rtnetlink.h>
#include <net/gre.h>
#include <net/dst_metadata.h>
#include <net/erspan.h>
static bool log_ecn_error = …;
module_param(log_ecn_error, bool, 0644);
MODULE_PARM_DESC(…) …;
static struct rtnl_link_ops ipgre_link_ops __read_mostly;
static const struct header_ops ipgre_header_ops;
static int ipgre_tunnel_init(struct net_device *dev);
static void erspan_build_header(struct sk_buff *skb,
u32 id, u32 index,
bool truncate, bool is_ipv4);
static unsigned int ipgre_net_id __read_mostly;
static unsigned int gre_tap_net_id __read_mostly;
static unsigned int erspan_net_id __read_mostly;
static int ipgre_err(struct sk_buff *skb, u32 info,
const struct tnl_ptk_info *tpi)
{ … }
static void gre_err(struct sk_buff *skb, u32 info)
{ … }
static bool is_erspan_type1(int gre_hdr_len)
{ … }
static int erspan_rcv(struct sk_buff *skb, struct tnl_ptk_info *tpi,
int gre_hdr_len)
{ … }
static int __ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
struct ip_tunnel_net *itn, int hdr_len, bool raw_proto)
{ … }
static int ipgre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi,
int hdr_len)
{ … }
static int gre_rcv(struct sk_buff *skb)
{ … }
static void __gre_xmit(struct sk_buff *skb, struct net_device *dev,
const struct iphdr *tnl_params,
__be16 proto)
{ … }
static int gre_handle_offloads(struct sk_buff *skb, bool csum)
{ … }
static void gre_fb_xmit(struct sk_buff *skb, struct net_device *dev,
__be16 proto)
{ … }
static void erspan_fb_xmit(struct sk_buff *skb, struct net_device *dev)
{ … }
static int gre_fill_metadata_dst(struct net_device *dev, struct sk_buff *skb)
{ … }
static netdev_tx_t ipgre_xmit(struct sk_buff *skb,
struct net_device *dev)
{ … }
static netdev_tx_t erspan_xmit(struct sk_buff *skb,
struct net_device *dev)
{ … }
static netdev_tx_t gre_tap_xmit(struct sk_buff *skb,
struct net_device *dev)
{ … }
static void ipgre_link_update(struct net_device *dev, bool set_mtu)
{ … }
static int ipgre_tunnel_ctl(struct net_device *dev,
struct ip_tunnel_parm_kern *p,
int cmd)
{ … }
static int ipgre_header(struct sk_buff *skb, struct net_device *dev,
unsigned short type,
const void *daddr, const void *saddr, unsigned int len)
{ … }
static int ipgre_header_parse(const struct sk_buff *skb, unsigned char *haddr)
{ … }
static const struct header_ops ipgre_header_ops = …;
#ifdef CONFIG_NET_IPGRE_BROADCAST
static int ipgre_open(struct net_device *dev)
{ … }
static int ipgre_close(struct net_device *dev)
{ … }
#endif
static const struct net_device_ops ipgre_netdev_ops = …;
#define GRE_FEATURES …
static void ipgre_tunnel_setup(struct net_device *dev)
{ … }
static void __gre_tunnel_init(struct net_device *dev)
{ … }
static int ipgre_tunnel_init(struct net_device *dev)
{ … }
static const struct gre_protocol ipgre_protocol = …;
static int __net_init ipgre_init_net(struct net *net)
{ … }
static void __net_exit ipgre_exit_batch_rtnl(struct list_head *list_net,
struct list_head *dev_to_kill)
{ … }
static struct pernet_operations ipgre_net_ops = …;
static int ipgre_tunnel_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static int ipgre_tap_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static int erspan_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static int ipgre_netlink_parms(struct net_device *dev,
struct nlattr *data[],
struct nlattr *tb[],
struct ip_tunnel_parm_kern *parms,
__u32 *fwmark)
{ … }
static int erspan_netlink_parms(struct net_device *dev,
struct nlattr *data[],
struct nlattr *tb[],
struct ip_tunnel_parm_kern *parms,
__u32 *fwmark)
{ … }
static bool ipgre_netlink_encap_parms(struct nlattr *data[],
struct ip_tunnel_encap *ipencap)
{ … }
static int gre_tap_init(struct net_device *dev)
{ … }
static const struct net_device_ops gre_tap_netdev_ops = …;
static int erspan_tunnel_init(struct net_device *dev)
{ … }
static const struct net_device_ops erspan_netdev_ops = …;
static void ipgre_tap_setup(struct net_device *dev)
{ … }
static int
ipgre_newlink_encap_setup(struct net_device *dev, struct nlattr *data[])
{ … }
static int ipgre_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static int erspan_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static int ipgre_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static int erspan_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static size_t ipgre_get_size(const struct net_device *dev)
{ … }
static int ipgre_fill_info(struct sk_buff *skb, const struct net_device *dev)
{ … }
static int erspan_fill_info(struct sk_buff *skb, const struct net_device *dev)
{ … }
static void erspan_setup(struct net_device *dev)
{ … }
static const struct nla_policy ipgre_policy[IFLA_GRE_MAX + 1] = …;
static struct rtnl_link_ops ipgre_link_ops __read_mostly = …;
static struct rtnl_link_ops ipgre_tap_ops __read_mostly = …;
static struct rtnl_link_ops erspan_link_ops __read_mostly = …;
struct net_device *gretap_fb_dev_create(struct net *net, const char *name,
u8 name_assign_type)
{ … }
EXPORT_SYMBOL_GPL(…);
static int __net_init ipgre_tap_init_net(struct net *net)
{ … }
static void __net_exit ipgre_tap_exit_batch_rtnl(struct list_head *list_net,
struct list_head *dev_to_kill)
{ … }
static struct pernet_operations ipgre_tap_net_ops = …;
static int __net_init erspan_init_net(struct net *net)
{ … }
static void __net_exit erspan_exit_batch_rtnl(struct list_head *net_list,
struct list_head *dev_to_kill)
{ … }
static struct pernet_operations erspan_net_ops = …;
static int __init ipgre_init(void)
{ … }
static void __exit ipgre_fini(void)
{ … }
module_init(…) …;
module_exit(ipgre_fini);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_RTNL_LINK(…) …;
MODULE_ALIAS_RTNL_LINK(…) …;
MODULE_ALIAS_RTNL_LINK(…) …;
MODULE_ALIAS_NETDEV(…) …;
MODULE_ALIAS_NETDEV(…) …;
MODULE_ALIAS_NETDEV(…) …;