linux/net/ipv6/ip6_gre.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 *	GRE over IPv6 protocol decoder.
 *
 *	Authors: Dmitry Kozlov ([email protected])
 */

#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/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 <linux/hash.h>
#include <linux/if_tunnel.h>
#include <linux/ip6_tunnel.h>

#include <net/sock.h>
#include <net/ip.h>
#include <net/ip_tunnels.h>
#include <net/icmp.h>
#include <net/protocol.h>
#include <net/addrconf.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/ipv6.h>
#include <net/ip6_fib.h>
#include <net/ip6_route.h>
#include <net/ip6_tunnel.h>
#include <net/gre.h>
#include <net/erspan.h>
#include <net/dst_metadata.h>


static bool log_ecn_error =;
module_param(log_ecn_error, bool, 0644);
MODULE_PARM_DESC();

#define IP6_GRE_HASH_SIZE_SHIFT
#define IP6_GRE_HASH_SIZE

static unsigned int ip6gre_net_id __read_mostly;
struct ip6gre_net {};

static struct rtnl_link_ops ip6gre_link_ops __read_mostly;
static struct rtnl_link_ops ip6gre_tap_ops __read_mostly;
static struct rtnl_link_ops ip6erspan_tap_ops __read_mostly;
static int ip6gre_tunnel_init(struct net_device *dev);
static void ip6gre_tunnel_setup(struct net_device *dev);
static void ip6gre_tunnel_link(struct ip6gre_net *ign, struct ip6_tnl *t);
static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu);
static void ip6erspan_tnl_link_config(struct ip6_tnl *t, int set_mtu);

/* Tunnel hash table */

/*
   4 hash tables:

   3: (remote,local)
   2: (remote,*)
   1: (*,local)
   0: (*,*)

   We require exact key match i.e. if a key is present in packet
   it will match only tunnel with the same key; if it is not present,
   it will match only keyless tunnel.

   All keysless packets, if not matched configured keyless tunnels
   will match fallback tunnel.
 */

#define HASH_KEY(key)
static u32 HASH_ADDR(const struct in6_addr *addr)
{}

#define tunnels_r_l
#define tunnels_r
#define tunnels_l
#define tunnels_wc

/* Given src, dst and key, find appropriate for input tunnel. */

static struct ip6_tnl *ip6gre_tunnel_lookup(struct net_device *dev,
		const struct in6_addr *remote, const struct in6_addr *local,
		__be32 key, __be16 gre_proto)
{}

static struct ip6_tnl __rcu **__ip6gre_bucket(struct ip6gre_net *ign,
		const struct __ip6_tnl_parm *p)
{}

static void ip6gre_tunnel_link_md(struct ip6gre_net *ign, struct ip6_tnl *t)
{}

static void ip6erspan_tunnel_link_md(struct ip6gre_net *ign, struct ip6_tnl *t)
{}

static void ip6gre_tunnel_unlink_md(struct ip6gre_net *ign, struct ip6_tnl *t)
{}

static void ip6erspan_tunnel_unlink_md(struct ip6gre_net *ign,
				       struct ip6_tnl *t)
{}

static inline struct ip6_tnl __rcu **ip6gre_bucket(struct ip6gre_net *ign,
		const struct ip6_tnl *t)
{}

static void ip6gre_tunnel_link(struct ip6gre_net *ign, struct ip6_tnl *t)
{}

static void ip6gre_tunnel_unlink(struct ip6gre_net *ign, struct ip6_tnl *t)
{}

static struct ip6_tnl *ip6gre_tunnel_find(struct net *net,
					   const struct __ip6_tnl_parm *parms,
					   int type)
{}

static struct ip6_tnl *ip6gre_tunnel_locate(struct net *net,
		const struct __ip6_tnl_parm *parms, int create)
{}

static void ip6erspan_tunnel_uninit(struct net_device *dev)
{}

static void ip6gre_tunnel_uninit(struct net_device *dev)
{}


static int ip6gre_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
		       u8 type, u8 code, int offset, __be32 info)
{}

static int ip6gre_rcv(struct sk_buff *skb, const struct tnl_ptk_info *tpi)
{}

static int ip6erspan_rcv(struct sk_buff *skb,
			 struct tnl_ptk_info *tpi,
			 int gre_hdr_len)
{}

static int gre_rcv(struct sk_buff *skb)
{}

static int gre_handle_offloads(struct sk_buff *skb, bool csum)
{}

static void prepare_ip6gre_xmit_ipv4(struct sk_buff *skb,
				     struct net_device *dev,
				     struct flowi6 *fl6, __u8 *dsfield,
				     int *encap_limit)
{}

static int prepare_ip6gre_xmit_ipv6(struct sk_buff *skb,
				    struct net_device *dev,
				    struct flowi6 *fl6, __u8 *dsfield,
				    int *encap_limit)
{}

static int prepare_ip6gre_xmit_other(struct sk_buff *skb,
				     struct net_device *dev,
				     struct flowi6 *fl6, __u8 *dsfield,
				     int *encap_limit)
{}

static struct ip_tunnel_info *skb_tunnel_info_txcheck(struct sk_buff *skb)
{}

static netdev_tx_t __gre6_xmit(struct sk_buff *skb,
			       struct net_device *dev, __u8 dsfield,
			       struct flowi6 *fl6, int encap_limit,
			       __u32 *pmtu, __be16 proto)
{}

static inline int ip6gre_xmit_ipv4(struct sk_buff *skb, struct net_device *dev)
{}

static inline int ip6gre_xmit_ipv6(struct sk_buff *skb, struct net_device *dev)
{}

static int ip6gre_xmit_other(struct sk_buff *skb, struct net_device *dev)
{}

static netdev_tx_t ip6gre_tunnel_xmit(struct sk_buff *skb,
	struct net_device *dev)
{}

static netdev_tx_t ip6erspan_tunnel_xmit(struct sk_buff *skb,
					 struct net_device *dev)
{}

static void ip6gre_tnl_link_config_common(struct ip6_tnl *t)
{}

static void ip6gre_tnl_link_config_route(struct ip6_tnl *t, int set_mtu,
					 int t_hlen)
{}

static int ip6gre_calc_hlen(struct ip6_tnl *tunnel)
{}

static void ip6gre_tnl_link_config(struct ip6_tnl *t, int set_mtu)
{}

static void ip6gre_tnl_copy_tnl_parm(struct ip6_tnl *t,
				     const struct __ip6_tnl_parm *p)
{}

static int ip6gre_tnl_change(struct ip6_tnl *t, const struct __ip6_tnl_parm *p,
			     int set_mtu)
{}

static void ip6gre_tnl_parm_from_user(struct __ip6_tnl_parm *p,
	const struct ip6_tnl_parm2 *u)
{}

static void ip6gre_tnl_parm_to_user(struct ip6_tnl_parm2 *u,
	const struct __ip6_tnl_parm *p)
{}

static int ip6gre_tunnel_siocdevprivate(struct net_device *dev,
					struct ifreq *ifr, void __user *data,
					int cmd)
{}

static int ip6gre_header(struct sk_buff *skb, struct net_device *dev,
			 unsigned short type, const void *daddr,
			 const void *saddr, unsigned int len)
{}

static const struct header_ops ip6gre_header_ops =;

static const struct net_device_ops ip6gre_netdev_ops =;

static void ip6gre_dev_free(struct net_device *dev)
{}

static void ip6gre_tunnel_setup(struct net_device *dev)
{}

#define GRE6_FEATURES

static void ip6gre_tnl_init_features(struct net_device *dev)
{}

static int ip6gre_tunnel_init_common(struct net_device *dev)
{}

static int ip6gre_tunnel_init(struct net_device *dev)
{}

static void ip6gre_fb_tunnel_init(struct net_device *dev)
{}

static struct inet6_protocol ip6gre_protocol __read_mostly =;

static void ip6gre_destroy_tunnels(struct net *net, struct list_head *head)
{}

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

static void __net_exit ip6gre_exit_batch_rtnl(struct list_head *net_list,
					      struct list_head *dev_to_kill)
{}

static struct pernet_operations ip6gre_net_ops =;

static int ip6gre_tunnel_validate(struct nlattr *tb[], struct nlattr *data[],
				  struct netlink_ext_ack *extack)
{}

static int ip6gre_tap_validate(struct nlattr *tb[], struct nlattr *data[],
			       struct netlink_ext_ack *extack)
{}

static int ip6erspan_tap_validate(struct nlattr *tb[], struct nlattr *data[],
				  struct netlink_ext_ack *extack)
{}

static void ip6erspan_set_version(struct nlattr *data[],
				  struct __ip6_tnl_parm *parms)
{}

static void ip6gre_netlink_parms(struct nlattr *data[],
				struct __ip6_tnl_parm *parms)
{}

static int ip6gre_tap_init(struct net_device *dev)
{}

static const struct net_device_ops ip6gre_tap_netdev_ops =;

static int ip6erspan_calc_hlen(struct ip6_tnl *tunnel)
{}

static int ip6erspan_tap_init(struct net_device *dev)
{}

static const struct net_device_ops ip6erspan_netdev_ops =;

static void ip6gre_tap_setup(struct net_device *dev)
{}

static bool ip6gre_netlink_encap_parms(struct nlattr *data[],
				       struct ip_tunnel_encap *ipencap)
{}

static int ip6gre_newlink_common(struct net *src_net, struct net_device *dev,
				 struct nlattr *tb[], struct nlattr *data[],
				 struct netlink_ext_ack *extack)
{}

static int ip6gre_newlink(struct net *src_net, struct net_device *dev,
			  struct nlattr *tb[], struct nlattr *data[],
			  struct netlink_ext_ack *extack)
{}

static struct ip6_tnl *
ip6gre_changelink_common(struct net_device *dev, struct nlattr *tb[],
			 struct nlattr *data[], struct __ip6_tnl_parm *p_p,
			 struct netlink_ext_ack *extack)
{}

static int ip6gre_changelink(struct net_device *dev, struct nlattr *tb[],
			     struct nlattr *data[],
			     struct netlink_ext_ack *extack)
{}

static void ip6gre_dellink(struct net_device *dev, struct list_head *head)
{}

static size_t ip6gre_get_size(const struct net_device *dev)
{}

static int ip6gre_fill_info(struct sk_buff *skb, const struct net_device *dev)
{}

static const struct nla_policy ip6gre_policy[IFLA_GRE_MAX + 1] =;

static void ip6erspan_tap_setup(struct net_device *dev)
{}

static int ip6erspan_newlink(struct net *src_net, struct net_device *dev,
			     struct nlattr *tb[], struct nlattr *data[],
			     struct netlink_ext_ack *extack)
{}

static void ip6erspan_tnl_link_config(struct ip6_tnl *t, int set_mtu)
{}

static int ip6erspan_tnl_change(struct ip6_tnl *t,
				const struct __ip6_tnl_parm *p, int set_mtu)
{}

static int ip6erspan_changelink(struct net_device *dev, struct nlattr *tb[],
				struct nlattr *data[],
				struct netlink_ext_ack *extack)
{}

static struct rtnl_link_ops ip6gre_link_ops __read_mostly =;

static struct rtnl_link_ops ip6gre_tap_ops __read_mostly =;

static struct rtnl_link_ops ip6erspan_tap_ops __read_mostly =;

/*
 *	And now the modules code and kernel interface.
 */

static int __init ip6gre_init(void)
{}

static void __exit ip6gre_fini(void)
{}

module_init();
module_exit(ip6gre_fini);
MODULE_LICENSE();
MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_ALIAS_RTNL_LINK();
MODULE_ALIAS_RTNL_LINK();
MODULE_ALIAS_RTNL_LINK();
MODULE_ALIAS_NETDEV();