1 /****************************************************************************
2  ****************************************************************************
3  ***
4  ***   This header was automatically generated from a Linux kernel header
5  ***   of the same name, to make information necessary for userspace to
6  ***   call into the kernel available to libc.  It contains only constants,
7  ***   structures, and macros generated from the original header, and thus,
8  ***   contains no copyrightable information.
9  ***
10  ***   To edit the content of this header, modify the corresponding
11  ***   source file (e.g. under external/kernel-headers/original/) then
12  ***   run bionic/libc/kernel/tools/update_all.py
13  ***
14  ***   Any manual change here will be lost the next time this script will
15  ***   be run. You've been warned!
16  ***
17  ****************************************************************************
18  ****************************************************************************/
19 #ifndef _UAPI_IF_TUNNEL_H_
20 #define _UAPI_IF_TUNNEL_H_
21 #include <linux/types.h>
22 #include <linux/if.h>
23 #include <linux/ip.h>
24 #include <linux/in6.h>
25 #include <asm/byteorder.h>
26 #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
27 #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
28 #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
29 #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
30 #define SIOCGETPRL (SIOCDEVPRIVATE + 4)
31 #define SIOCADDPRL (SIOCDEVPRIVATE + 5)
32 #define SIOCDELPRL (SIOCDEVPRIVATE + 6)
33 #define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
34 #define SIOCGET6RD (SIOCDEVPRIVATE + 8)
35 #define SIOCADD6RD (SIOCDEVPRIVATE + 9)
36 #define SIOCDEL6RD (SIOCDEVPRIVATE + 10)
37 #define SIOCCHG6RD (SIOCDEVPRIVATE + 11)
38 #define GRE_CSUM __cpu_to_be16(0x8000)
39 #define GRE_ROUTING __cpu_to_be16(0x4000)
40 #define GRE_KEY __cpu_to_be16(0x2000)
41 #define GRE_SEQ __cpu_to_be16(0x1000)
42 #define GRE_STRICT __cpu_to_be16(0x0800)
43 #define GRE_REC __cpu_to_be16(0x0700)
44 #define GRE_ACK __cpu_to_be16(0x0080)
45 #define GRE_FLAGS __cpu_to_be16(0x0078)
46 #define GRE_VERSION __cpu_to_be16(0x0007)
47 #define GRE_IS_CSUM(f) ((f) & GRE_CSUM)
48 #define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING)
49 #define GRE_IS_KEY(f) ((f) & GRE_KEY)
50 #define GRE_IS_SEQ(f) ((f) & GRE_SEQ)
51 #define GRE_IS_STRICT(f) ((f) & GRE_STRICT)
52 #define GRE_IS_REC(f) ((f) & GRE_REC)
53 #define GRE_IS_ACK(f) ((f) & GRE_ACK)
54 #define GRE_VERSION_0 __cpu_to_be16(0x0000)
55 #define GRE_VERSION_1 __cpu_to_be16(0x0001)
56 #define GRE_PROTO_PPP __cpu_to_be16(0x880b)
57 #define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff)
58 struct ip_tunnel_parm {
59   char name[IFNAMSIZ];
60   int link;
61   __be16 i_flags;
62   __be16 o_flags;
63   __be32 i_key;
64   __be32 o_key;
65   struct iphdr iph;
66 };
67 enum {
68   IFLA_IPTUN_UNSPEC,
69   IFLA_IPTUN_LINK,
70   IFLA_IPTUN_LOCAL,
71   IFLA_IPTUN_REMOTE,
72   IFLA_IPTUN_TTL,
73   IFLA_IPTUN_TOS,
74   IFLA_IPTUN_ENCAP_LIMIT,
75   IFLA_IPTUN_FLOWINFO,
76   IFLA_IPTUN_FLAGS,
77   IFLA_IPTUN_PROTO,
78   IFLA_IPTUN_PMTUDISC,
79   IFLA_IPTUN_6RD_PREFIX,
80   IFLA_IPTUN_6RD_RELAY_PREFIX,
81   IFLA_IPTUN_6RD_PREFIXLEN,
82   IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
83   IFLA_IPTUN_ENCAP_TYPE,
84   IFLA_IPTUN_ENCAP_FLAGS,
85   IFLA_IPTUN_ENCAP_SPORT,
86   IFLA_IPTUN_ENCAP_DPORT,
87   IFLA_IPTUN_COLLECT_METADATA,
88   IFLA_IPTUN_FWMARK,
89   __IFLA_IPTUN_MAX,
90 };
91 #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
92 enum tunnel_encap_types {
93   TUNNEL_ENCAP_NONE,
94   TUNNEL_ENCAP_FOU,
95   TUNNEL_ENCAP_GUE,
96   TUNNEL_ENCAP_MPLS,
97 };
98 #define TUNNEL_ENCAP_FLAG_CSUM (1 << 0)
99 #define TUNNEL_ENCAP_FLAG_CSUM6 (1 << 1)
100 #define TUNNEL_ENCAP_FLAG_REMCSUM (1 << 2)
101 #define SIT_ISATAP 0x0001
102 struct ip_tunnel_prl {
103   __be32 addr;
104   __u16 flags;
105   __u16 __reserved;
106   __u32 datalen;
107   __u32 __reserved2;
108 };
109 #define PRL_DEFAULT 0x0001
110 struct ip_tunnel_6rd {
111   struct in6_addr prefix;
112   __be32 relay_prefix;
113   __u16 prefixlen;
114   __u16 relay_prefixlen;
115 };
116 enum {
117   IFLA_GRE_UNSPEC,
118   IFLA_GRE_LINK,
119   IFLA_GRE_IFLAGS,
120   IFLA_GRE_OFLAGS,
121   IFLA_GRE_IKEY,
122   IFLA_GRE_OKEY,
123   IFLA_GRE_LOCAL,
124   IFLA_GRE_REMOTE,
125   IFLA_GRE_TTL,
126   IFLA_GRE_TOS,
127   IFLA_GRE_PMTUDISC,
128   IFLA_GRE_ENCAP_LIMIT,
129   IFLA_GRE_FLOWINFO,
130   IFLA_GRE_FLAGS,
131   IFLA_GRE_ENCAP_TYPE,
132   IFLA_GRE_ENCAP_FLAGS,
133   IFLA_GRE_ENCAP_SPORT,
134   IFLA_GRE_ENCAP_DPORT,
135   IFLA_GRE_COLLECT_METADATA,
136   IFLA_GRE_IGNORE_DF,
137   IFLA_GRE_FWMARK,
138   IFLA_GRE_ERSPAN_INDEX,
139   IFLA_GRE_ERSPAN_VER,
140   IFLA_GRE_ERSPAN_DIR,
141   IFLA_GRE_ERSPAN_HWID,
142   __IFLA_GRE_MAX,
143 };
144 #define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
145 #define VTI_ISVTI ((__force __be16) 0x0001)
146 enum {
147   IFLA_VTI_UNSPEC,
148   IFLA_VTI_LINK,
149   IFLA_VTI_IKEY,
150   IFLA_VTI_OKEY,
151   IFLA_VTI_LOCAL,
152   IFLA_VTI_REMOTE,
153   IFLA_VTI_FWMARK,
154   __IFLA_VTI_MAX,
155 };
156 #define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
157 #define TUNNEL_CSUM __cpu_to_be16(0x01)
158 #define TUNNEL_ROUTING __cpu_to_be16(0x02)
159 #define TUNNEL_KEY __cpu_to_be16(0x04)
160 #define TUNNEL_SEQ __cpu_to_be16(0x08)
161 #define TUNNEL_STRICT __cpu_to_be16(0x10)
162 #define TUNNEL_REC __cpu_to_be16(0x20)
163 #define TUNNEL_VERSION __cpu_to_be16(0x40)
164 #define TUNNEL_NO_KEY __cpu_to_be16(0x80)
165 #define TUNNEL_DONT_FRAGMENT __cpu_to_be16(0x0100)
166 #define TUNNEL_OAM __cpu_to_be16(0x0200)
167 #define TUNNEL_CRIT_OPT __cpu_to_be16(0x0400)
168 #define TUNNEL_GENEVE_OPT __cpu_to_be16(0x0800)
169 #define TUNNEL_VXLAN_OPT __cpu_to_be16(0x1000)
170 #define TUNNEL_NOCACHE __cpu_to_be16(0x2000)
171 #define TUNNEL_ERSPAN_OPT __cpu_to_be16(0x4000)
172 #define TUNNEL_OPTIONS_PRESENT (TUNNEL_GENEVE_OPT | TUNNEL_VXLAN_OPT | TUNNEL_ERSPAN_OPT)
173 #endif
174