aboutsummaryrefslogtreecommitdiff
path: root/datapath/linux/compat/include/net/vxlan.h
blob: 1b801dda8d2a075baa882f3e4ce6f8cb7380d4b7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
#ifndef __NET_VXLAN_WRAPPER_H
#define __NET_VXLAN_WRAPPER_H  1

#include <linux/skbuff.h>
#include <linux/netdevice.h>
#include <linux/udp.h>
#include <net/gre.h>

#include <linux/version.h>
#ifdef GRE_USE_KERNEL_GRE_HANDLE_OFFLOADS
#include_next <net/vxlan.h>

static inline int rpl_vxlan_xmit_skb(struct vxlan_sock *vs,
                   struct rtable *rt, struct sk_buff *skb,
                   __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
                   __be16 src_port, __be16 dst_port, __be32 vni)
{
	if (skb->encapsulation && skb_is_gso(skb)) {
		kfree_skb(skb);
		return -ENOSYS;
	}

#ifdef HAVE_VXLAN_XMIT_SKB_XNET_ARG
	return vxlan_xmit_skb(vs, rt, skb, src, dst, tos, ttl, df,
			      src_port, dst_port, vni, false);
#else
#ifndef HAVE_IPTUNNEL_XMIT_NET
	return vxlan_xmit_skb(vs, rt, skb, src, dst, tos, ttl, df,
			      src_port, dst_port, vni);
#else
	return vxlan_xmit_skb(NULL, vs, rt, skb, src, dst, tos, ttl, df,
			      src_port, dst_port, vni);
#endif

#endif
}

#define vxlan_xmit_skb rpl_vxlan_xmit_skb
#else

struct vxlan_sock;
typedef void (vxlan_rcv_t)(struct vxlan_sock *vs, struct sk_buff *skb, __be32 key);

/* per UDP socket information */
struct vxlan_sock {
	struct hlist_node hlist;
	vxlan_rcv_t	 *rcv;
	void		 *data;
	struct work_struct del_work;
	struct socket	 *sock;
	struct rcu_head	  rcu;
};

struct vxlan_sock *vxlan_sock_add(struct net *net, __be16 port,
				  vxlan_rcv_t *rcv, void *data,
				  bool no_share, bool ipv6);

void vxlan_sock_release(struct vxlan_sock *vs);

int vxlan_xmit_skb(struct vxlan_sock *vs,
		   struct rtable *rt, struct sk_buff *skb,
		   __be32 src, __be32 dst, __u8 tos, __u8 ttl, __be16 df,
		   __be16 src_port, __be16 dst_port, __be32 vni);

__be16 vxlan_src_port(__u16 port_min, __u16 port_max, struct sk_buff *skb);

#endif /* 3.12 */
#endif