#define pr_fmt(fmt) …
#include <linux/module.h>
#include <linux/capability.h>
#include <linux/errno.h>
#include <linux/types.h>
#include <linux/socket.h>
#include <linux/sockios.h>
#include <linux/net.h>
#include <linux/in6.h>
#include <linux/netdevice.h>
#include <linux/if_arp.h>
#include <linux/icmp.h>
#include <linux/slab.h>
#include <linux/uaccess.h>
#include <linux/init.h>
#include <linux/netfilter_ipv4.h>
#include <linux/if_ether.h>
#include <net/sock.h>
#include <net/snmp.h>
#include <net/ipv6.h>
#include <net/protocol.h>
#include <net/transp_v6.h>
#include <net/ip6_fib.h>
#include <net/ip6_route.h>
#include <net/ndisc.h>
#include <net/addrconf.h>
#include <net/ip.h>
#include <net/udp.h>
#include <net/icmp.h>
#include <net/ip_tunnels.h>
#include <net/inet_ecn.h>
#include <net/xfrm.h>
#include <net/dsfield.h>
#include <net/net_namespace.h>
#include <net/netns/generic.h>
#define IP6_SIT_HASH_SIZE …
#define HASH(addr) …
static bool log_ecn_error = …;
module_param(log_ecn_error, bool, 0644);
MODULE_PARM_DESC(…) …;
static int ipip6_tunnel_init(struct net_device *dev);
static void ipip6_tunnel_setup(struct net_device *dev);
static void ipip6_dev_free(struct net_device *dev);
static bool check_6rd(struct ip_tunnel *tunnel, const struct in6_addr *v6dst,
__be32 *v4dst);
static struct rtnl_link_ops sit_link_ops __read_mostly;
static unsigned int sit_net_id __read_mostly;
struct sit_net { … };
static inline struct sit_net *dev_to_sit_net(struct net_device *dev)
{ … }
static struct ip_tunnel *ipip6_tunnel_lookup(struct net *net,
struct net_device *dev,
__be32 remote, __be32 local,
int sifindex)
{ … }
static struct ip_tunnel __rcu **
__ipip6_bucket(struct sit_net *sitn, struct ip_tunnel_parm_kern *parms)
{ … }
static inline struct ip_tunnel __rcu **ipip6_bucket(struct sit_net *sitn,
struct ip_tunnel *t)
{ … }
static void ipip6_tunnel_unlink(struct sit_net *sitn, struct ip_tunnel *t)
{ … }
static void ipip6_tunnel_link(struct sit_net *sitn, struct ip_tunnel *t)
{ … }
static void ipip6_tunnel_clone_6rd(struct net_device *dev, struct sit_net *sitn)
{ … }
static int ipip6_tunnel_create(struct net_device *dev)
{ … }
static struct ip_tunnel *ipip6_tunnel_locate(struct net *net,
struct ip_tunnel_parm_kern *parms,
int create)
{ … }
#define for_each_prl_rcu(start) …
static struct ip_tunnel_prl_entry *
__ipip6_tunnel_locate_prl(struct ip_tunnel *t, __be32 addr)
{ … }
static int ipip6_tunnel_get_prl(struct net_device *dev, struct ip_tunnel_prl __user *a)
{ … }
static int
ipip6_tunnel_add_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a, int chg)
{ … }
static void prl_list_destroy_rcu(struct rcu_head *head)
{ … }
static int
ipip6_tunnel_del_prl(struct ip_tunnel *t, struct ip_tunnel_prl *a)
{ … }
static int ipip6_tunnel_prl_ctl(struct net_device *dev,
struct ip_tunnel_prl __user *data, int cmd)
{ … }
static int
isatap_chksrc(struct sk_buff *skb, const struct iphdr *iph, struct ip_tunnel *t)
{ … }
static void ipip6_tunnel_uninit(struct net_device *dev)
{ … }
static int ipip6_err(struct sk_buff *skb, u32 info)
{ … }
static inline bool is_spoofed_6rd(struct ip_tunnel *tunnel, const __be32 v4addr,
const struct in6_addr *v6addr)
{ … }
static bool only_dnatted(const struct ip_tunnel *tunnel,
const struct in6_addr *v6dst)
{ … }
static bool packet_is_spoofed(struct sk_buff *skb,
const struct iphdr *iph,
struct ip_tunnel *tunnel)
{ … }
static int ipip6_rcv(struct sk_buff *skb)
{ … }
static const struct tnl_ptk_info ipip_tpi = …;
#if IS_ENABLED(CONFIG_MPLS)
static const struct tnl_ptk_info mplsip_tpi = …;
#endif
static int sit_tunnel_rcv(struct sk_buff *skb, u8 ipproto)
{ … }
static int ipip_rcv(struct sk_buff *skb)
{ … }
#if IS_ENABLED(CONFIG_MPLS)
static int mplsip_rcv(struct sk_buff *skb)
{ … }
#endif
static bool check_6rd(struct ip_tunnel *tunnel, const struct in6_addr *v6dst,
__be32 *v4dst)
{ … }
static inline __be32 try_6rd(struct ip_tunnel *tunnel,
const struct in6_addr *v6dst)
{ … }
static netdev_tx_t ipip6_tunnel_xmit(struct sk_buff *skb,
struct net_device *dev)
{ … }
static netdev_tx_t sit_tunnel_xmit__(struct sk_buff *skb,
struct net_device *dev, u8 ipproto)
{ … }
static netdev_tx_t sit_tunnel_xmit(struct sk_buff *skb,
struct net_device *dev)
{ … }
static void ipip6_tunnel_bind_dev(struct net_device *dev)
{ … }
static void ipip6_tunnel_update(struct ip_tunnel *t,
struct ip_tunnel_parm_kern *p,
__u32 fwmark)
{ … }
#ifdef CONFIG_IPV6_SIT_6RD
static int ipip6_tunnel_update_6rd(struct ip_tunnel *t,
struct ip_tunnel_6rd *ip6rd)
{ … }
static int
ipip6_tunnel_get6rd(struct net_device *dev, struct ip_tunnel_parm __user *data)
{ … }
static int
ipip6_tunnel_6rdctl(struct net_device *dev, struct ip_tunnel_6rd __user *data,
int cmd)
{ … }
#endif
static bool ipip6_valid_ip_proto(u8 ipproto)
{ … }
static int
__ipip6_tunnel_ioctl_validate(struct net *net, struct ip_tunnel_parm_kern *p)
{ … }
static int
ipip6_tunnel_get(struct net_device *dev, struct ip_tunnel_parm_kern *p)
{ … }
static int
ipip6_tunnel_add(struct net_device *dev, struct ip_tunnel_parm_kern *p)
{ … }
static int
ipip6_tunnel_change(struct net_device *dev, struct ip_tunnel_parm_kern *p)
{ … }
static int
ipip6_tunnel_del(struct net_device *dev, struct ip_tunnel_parm_kern *p)
{ … }
static int
ipip6_tunnel_ctl(struct net_device *dev, struct ip_tunnel_parm_kern *p,
int cmd)
{ … }
static int
ipip6_tunnel_siocdevprivate(struct net_device *dev, struct ifreq *ifr,
void __user *data, int cmd)
{ … }
static const struct net_device_ops ipip6_netdev_ops = …;
static void ipip6_dev_free(struct net_device *dev)
{ … }
#define SIT_FEATURES …
static void ipip6_tunnel_setup(struct net_device *dev)
{ … }
static int ipip6_tunnel_init(struct net_device *dev)
{ … }
static void __net_init ipip6_fb_tunnel_init(struct net_device *dev)
{ … }
static int ipip6_validate(struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static void ipip6_netlink_parms(struct nlattr *data[],
struct ip_tunnel_parm_kern *parms,
__u32 *fwmark)
{ … }
#ifdef CONFIG_IPV6_SIT_6RD
static bool ipip6_netlink_6rd_parms(struct nlattr *data[],
struct ip_tunnel_6rd *ip6rd)
{ … }
#endif
static int ipip6_newlink(struct net *src_net, struct net_device *dev,
struct nlattr *tb[], struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static int ipip6_changelink(struct net_device *dev, struct nlattr *tb[],
struct nlattr *data[],
struct netlink_ext_ack *extack)
{ … }
static size_t ipip6_get_size(const struct net_device *dev)
{ … }
static int ipip6_fill_info(struct sk_buff *skb, const struct net_device *dev)
{ … }
static const struct nla_policy ipip6_policy[IFLA_IPTUN_MAX + 1] = …;
static void ipip6_dellink(struct net_device *dev, struct list_head *head)
{ … }
static struct rtnl_link_ops sit_link_ops __read_mostly = …;
static struct xfrm_tunnel sit_handler __read_mostly = …;
static struct xfrm_tunnel ipip_handler __read_mostly = …;
#if IS_ENABLED(CONFIG_MPLS)
static struct xfrm_tunnel mplsip_handler __read_mostly = …;
#endif
static void __net_exit sit_destroy_tunnels(struct net *net,
struct list_head *head)
{ … }
static int __net_init sit_init_net(struct net *net)
{ … }
static void __net_exit sit_exit_batch_rtnl(struct list_head *net_list,
struct list_head *dev_to_kill)
{ … }
static struct pernet_operations sit_net_ops = …;
static void __exit sit_cleanup(void)
{ … }
static int __init sit_init(void)
{ … }
module_init(…) …;
module_exit(sit_cleanup);
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
MODULE_ALIAS_RTNL_LINK(…) …;
MODULE_ALIAS_NETDEV(…) …;