blob: 361b9f0f20d7a0161e9a600b13ccf5309391c4f9 [file] [log] [blame]
David Howells607ca462012-10-13 10:46:48 +01001#ifndef _UAPI_IF_TUNNEL_H_
2#define _UAPI_IF_TUNNEL_H_
3
4#include <linux/types.h>
5#include <asm/byteorder.h>
6
7
8#define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
9#define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
10#define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
11#define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
12#define SIOCGETPRL (SIOCDEVPRIVATE + 4)
13#define SIOCADDPRL (SIOCDEVPRIVATE + 5)
14#define SIOCDELPRL (SIOCDEVPRIVATE + 6)
15#define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
16#define SIOCGET6RD (SIOCDEVPRIVATE + 8)
17#define SIOCADD6RD (SIOCDEVPRIVATE + 9)
18#define SIOCDEL6RD (SIOCDEVPRIVATE + 10)
19#define SIOCCHG6RD (SIOCDEVPRIVATE + 11)
20
21#define GRE_CSUM __cpu_to_be16(0x8000)
22#define GRE_ROUTING __cpu_to_be16(0x4000)
23#define GRE_KEY __cpu_to_be16(0x2000)
24#define GRE_SEQ __cpu_to_be16(0x1000)
25#define GRE_STRICT __cpu_to_be16(0x0800)
26#define GRE_REC __cpu_to_be16(0x0700)
Gao Fengab10dcc2016-08-09 12:38:24 +080027#define GRE_ACK __cpu_to_be16(0x0080)
28#define GRE_FLAGS __cpu_to_be16(0x0078)
David Howells607ca462012-10-13 10:46:48 +010029#define GRE_VERSION __cpu_to_be16(0x0007)
30
Gao Feng03459342016-08-13 00:30:48 +080031#define GRE_IS_CSUM(f) ((f) & GRE_CSUM)
32#define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING)
33#define GRE_IS_KEY(f) ((f) & GRE_KEY)
34#define GRE_IS_SEQ(f) ((f) & GRE_SEQ)
35#define GRE_IS_STRICT(f) ((f) & GRE_STRICT)
36#define GRE_IS_REC(f) ((f) & GRE_REC)
37#define GRE_IS_ACK(f) ((f) & GRE_ACK)
38
39#define GRE_VERSION_1 __cpu_to_be16(0x0001)
40#define GRE_PROTO_PPP __cpu_to_be16(0x880b)
Gao Fengab10dcc2016-08-09 12:38:24 +080041#define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff)
42
David Howells607ca462012-10-13 10:46:48 +010043struct ip_tunnel_parm {
44 char name[IFNAMSIZ];
45 int link;
46 __be16 i_flags;
47 __be16 o_flags;
48 __be32 i_key;
49 __be32 o_key;
50 struct iphdr iph;
51};
52
Nicolas Dichtel09746582012-11-09 06:09:59 +000053enum {
54 IFLA_IPTUN_UNSPEC,
55 IFLA_IPTUN_LINK,
56 IFLA_IPTUN_LOCAL,
57 IFLA_IPTUN_REMOTE,
58 IFLA_IPTUN_TTL,
59 IFLA_IPTUN_TOS,
Nicolas Dichtelc075b132012-11-09 06:10:01 +000060 IFLA_IPTUN_ENCAP_LIMIT,
61 IFLA_IPTUN_FLOWINFO,
62 IFLA_IPTUN_FLAGS,
Nicolas Dichtelcfa323b2012-11-14 05:13:58 +000063 IFLA_IPTUN_PROTO,
Nicolas Dichtelbefe2aa2012-11-14 05:14:02 +000064 IFLA_IPTUN_PMTUDISC,
Nicolas Dichtele2f1f072012-11-19 22:41:45 +000065 IFLA_IPTUN_6RD_PREFIX,
66 IFLA_IPTUN_6RD_RELAY_PREFIX,
67 IFLA_IPTUN_6RD_PREFIXLEN,
68 IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
Tom Herbert56328482014-09-17 12:25:58 -070069 IFLA_IPTUN_ENCAP_TYPE,
70 IFLA_IPTUN_ENCAP_FLAGS,
71 IFLA_IPTUN_ENCAP_SPORT,
72 IFLA_IPTUN_ENCAP_DPORT,
Nicolas Dichtel09746582012-11-09 06:09:59 +000073 __IFLA_IPTUN_MAX,
74};
75#define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
76
Tom Herbert56328482014-09-17 12:25:58 -070077enum tunnel_encap_types {
78 TUNNEL_ENCAP_NONE,
79 TUNNEL_ENCAP_FOU,
Tom Herbertbc1fc392014-10-03 15:48:10 -070080 TUNNEL_ENCAP_GUE,
Tom Herbert56328482014-09-17 12:25:58 -070081};
82
83#define TUNNEL_ENCAP_FLAG_CSUM (1<<0)
84#define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1)
Tom Herbertb17f7092014-11-04 09:06:56 -080085#define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2)
Tom Herbert56328482014-09-17 12:25:58 -070086
David Howells607ca462012-10-13 10:46:48 +010087/* SIT-mode i_flags */
88#define SIT_ISATAP 0x0001
89
90struct ip_tunnel_prl {
91 __be32 addr;
92 __u16 flags;
93 __u16 __reserved;
94 __u32 datalen;
95 __u32 __reserved2;
96 /* data follows */
97};
98
99/* PRL flags */
100#define PRL_DEFAULT 0x0001
101
102struct ip_tunnel_6rd {
103 struct in6_addr prefix;
104 __be32 relay_prefix;
105 __u16 prefixlen;
106 __u16 relay_prefixlen;
107};
108
109enum {
110 IFLA_GRE_UNSPEC,
111 IFLA_GRE_LINK,
112 IFLA_GRE_IFLAGS,
113 IFLA_GRE_OFLAGS,
114 IFLA_GRE_IKEY,
115 IFLA_GRE_OKEY,
116 IFLA_GRE_LOCAL,
117 IFLA_GRE_REMOTE,
118 IFLA_GRE_TTL,
119 IFLA_GRE_TOS,
120 IFLA_GRE_PMTUDISC,
121 IFLA_GRE_ENCAP_LIMIT,
122 IFLA_GRE_FLOWINFO,
123 IFLA_GRE_FLAGS,
Tom Herbert4565e992014-09-17 12:26:01 -0700124 IFLA_GRE_ENCAP_TYPE,
125 IFLA_GRE_ENCAP_FLAGS,
126 IFLA_GRE_ENCAP_SPORT,
127 IFLA_GRE_ENCAP_DPORT,
Pravin B Shelar2e15ea32015-08-07 23:51:42 -0700128 IFLA_GRE_COLLECT_METADATA,
Philip Prindeville22a59be2016-06-14 15:53:02 -0600129 IFLA_GRE_IGNORE_DF,
David Howells607ca462012-10-13 10:46:48 +0100130 __IFLA_GRE_MAX,
131};
132
133#define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
134
135/* VTI-mode i_flags */
Dmitry Popovefd0f112014-06-11 15:09:14 +0400136#define VTI_ISVTI ((__force __be16)0x0001)
David Howells607ca462012-10-13 10:46:48 +0100137
138enum {
139 IFLA_VTI_UNSPEC,
140 IFLA_VTI_LINK,
141 IFLA_VTI_IKEY,
142 IFLA_VTI_OKEY,
143 IFLA_VTI_LOCAL,
144 IFLA_VTI_REMOTE,
145 __IFLA_VTI_MAX,
146};
147
148#define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
149#endif /* _UAPI_IF_TUNNEL_H_ */