/* * IPv6 tunneling device * Linux INET6 implementation * * Authors: * Ville Nuorvala <vnuorval@tcs.hut.fi> * Yasuyuki Kozakai <kozakai@linux-ipv6.org> * * Based on: * linux/net/ipv6/sit.c and linux/net/ipv4/ipip.c * * RFC 2473 * * 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. * */#define pr_fmt(fmt) KBUILD_MODNAME": " fmt#include <linux/module.h>#include <linux/capability.h>#include <linux/errno.h>#include <linux/types.h>#include <linux/sockios.h>#include <linux/icmp.h>#include <linux/if.h>#include <linux/in.h>#include <linux/ip.h>#include <linux/if_tunnel.h>#include <linux/net.h>#include <linux/in6.h>#include <linux/netdevice.h>#include <linux/if_arp.h>#include <linux/icmpv6.h>#include <linux/init.h>#include <linux/route.h>#include <linux/rtnetlink.h>#include <linux/netfilter_ipv6.h>#include <linux/slab.h>#include <asm/uaccess.h>#include <linux/atomic.h>#include <net/icmp.h>#include <net/ip.h>#include <net/ipv6.h>#include <net/ip6_route.h>#include <net/addrconf.h>#include <net/ip6_tunnel.h>#include <net/xfrm.h>#include <net/dsfield.h>#include <net/inet_ecn.h>#include <net/net_namespace.h>#include <net/netns/generic.h>MODULE_AUTHOR("Ville Nuorvala");MODULE_DESCRIPTION("IPv6 tunneling device");MODULE_LICENSE("GPL");MODULE_ALIAS_NETDEV("ip6tnl0");#ifdef IP6_TNL_DEBUG#define IP6_TNL_TRACE(x...) pr_debug("%s:" x"\n", __func__)#else#define IP6_TNL_TRACE(x...) do {;} while(0)#endif#define IPV6_TCLASS_MASK (IPV6_FLOWINFO_MASK & ~IPV6_FLOWLABEL_MASK)#define IPV6_TCLASS_SHIFT 20#define HASH_SIZE 32#define HASH(addr) ((__force u32)((addr)->s6_addr32[0] ^ (addr)->s6_addr32[1] ^ \ (addr)->s6_addr32[2] ^ (addr)->s6_addr32[3]) & \ (HASH_SIZE - 1))static intip6_tnl_dev_init(struct net_device *dev);static voidip6_tnl_dev_setup(struct net_device *dev);static int ip6_tnl_net_id __read_mostly;struct ip6_tnl_net {/* the IPv6 tunnel fallback device */struct net_device *fb_tnl_dev;/* lists for storing tunnels in use */struct ip6_tnl __rcu *tnls_r_l[HASH_SIZE];struct ip6_tnl __rcu *tnls_wc[