David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 1 | #ifndef _UAPI_IF_TUNNEL_H_ |
| 2 | #define _UAPI_IF_TUNNEL_H_ |
| 3 | |
| 4 | #include <linux/types.h> |
Mikko Rapeli | 1fe8e0f | 2016-08-22 20:32:39 +0200 | [diff] [blame] | 5 | #include <linux/if.h> |
| 6 | #include <linux/ip.h> |
| 7 | #include <linux/in6.h> |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 8 | #include <asm/byteorder.h> |
| 9 | |
| 10 | |
| 11 | #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) |
| 12 | #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) |
| 13 | #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) |
| 14 | #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) |
| 15 | #define SIOCGETPRL (SIOCDEVPRIVATE + 4) |
| 16 | #define SIOCADDPRL (SIOCDEVPRIVATE + 5) |
| 17 | #define SIOCDELPRL (SIOCDEVPRIVATE + 6) |
| 18 | #define SIOCCHGPRL (SIOCDEVPRIVATE + 7) |
| 19 | #define SIOCGET6RD (SIOCDEVPRIVATE + 8) |
| 20 | #define SIOCADD6RD (SIOCDEVPRIVATE + 9) |
| 21 | #define SIOCDEL6RD (SIOCDEVPRIVATE + 10) |
| 22 | #define SIOCCHG6RD (SIOCDEVPRIVATE + 11) |
| 23 | |
| 24 | #define GRE_CSUM __cpu_to_be16(0x8000) |
| 25 | #define GRE_ROUTING __cpu_to_be16(0x4000) |
| 26 | #define GRE_KEY __cpu_to_be16(0x2000) |
| 27 | #define GRE_SEQ __cpu_to_be16(0x1000) |
| 28 | #define GRE_STRICT __cpu_to_be16(0x0800) |
| 29 | #define GRE_REC __cpu_to_be16(0x0700) |
Gao Feng | ab10dcc | 2016-08-09 12:38:24 +0800 | [diff] [blame] | 30 | #define GRE_ACK __cpu_to_be16(0x0080) |
| 31 | #define GRE_FLAGS __cpu_to_be16(0x0078) |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 32 | #define GRE_VERSION __cpu_to_be16(0x0007) |
| 33 | |
Gao Feng | 0345934 | 2016-08-13 00:30:48 +0800 | [diff] [blame] | 34 | #define GRE_IS_CSUM(f) ((f) & GRE_CSUM) |
| 35 | #define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING) |
| 36 | #define GRE_IS_KEY(f) ((f) & GRE_KEY) |
| 37 | #define GRE_IS_SEQ(f) ((f) & GRE_SEQ) |
| 38 | #define GRE_IS_STRICT(f) ((f) & GRE_STRICT) |
| 39 | #define GRE_IS_REC(f) ((f) & GRE_REC) |
| 40 | #define GRE_IS_ACK(f) ((f) & GRE_ACK) |
| 41 | |
Gao Feng | ecc6569 | 2016-08-25 23:08:11 +0800 | [diff] [blame] | 42 | #define GRE_VERSION_0 __cpu_to_be16(0x0000) |
Gao Feng | 0345934 | 2016-08-13 00:30:48 +0800 | [diff] [blame] | 43 | #define GRE_VERSION_1 __cpu_to_be16(0x0001) |
| 44 | #define GRE_PROTO_PPP __cpu_to_be16(0x880b) |
Gao Feng | ab10dcc | 2016-08-09 12:38:24 +0800 | [diff] [blame] | 45 | #define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff) |
| 46 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 47 | struct ip_tunnel_parm { |
| 48 | char name[IFNAMSIZ]; |
| 49 | int link; |
| 50 | __be16 i_flags; |
| 51 | __be16 o_flags; |
| 52 | __be32 i_key; |
| 53 | __be32 o_key; |
| 54 | struct iphdr iph; |
| 55 | }; |
| 56 | |
Nicolas Dichtel | 0974658 | 2012-11-09 06:09:59 +0000 | [diff] [blame] | 57 | enum { |
| 58 | IFLA_IPTUN_UNSPEC, |
| 59 | IFLA_IPTUN_LINK, |
| 60 | IFLA_IPTUN_LOCAL, |
| 61 | IFLA_IPTUN_REMOTE, |
| 62 | IFLA_IPTUN_TTL, |
| 63 | IFLA_IPTUN_TOS, |
Nicolas Dichtel | c075b13 | 2012-11-09 06:10:01 +0000 | [diff] [blame] | 64 | IFLA_IPTUN_ENCAP_LIMIT, |
| 65 | IFLA_IPTUN_FLOWINFO, |
| 66 | IFLA_IPTUN_FLAGS, |
Nicolas Dichtel | cfa323b | 2012-11-14 05:13:58 +0000 | [diff] [blame] | 67 | IFLA_IPTUN_PROTO, |
Nicolas Dichtel | befe2aa | 2012-11-14 05:14:02 +0000 | [diff] [blame] | 68 | IFLA_IPTUN_PMTUDISC, |
Nicolas Dichtel | e2f1f07 | 2012-11-19 22:41:45 +0000 | [diff] [blame] | 69 | IFLA_IPTUN_6RD_PREFIX, |
| 70 | IFLA_IPTUN_6RD_RELAY_PREFIX, |
| 71 | IFLA_IPTUN_6RD_PREFIXLEN, |
| 72 | IFLA_IPTUN_6RD_RELAY_PREFIXLEN, |
Tom Herbert | 5632848 | 2014-09-17 12:25:58 -0700 | [diff] [blame] | 73 | IFLA_IPTUN_ENCAP_TYPE, |
| 74 | IFLA_IPTUN_ENCAP_FLAGS, |
| 75 | IFLA_IPTUN_ENCAP_SPORT, |
| 76 | IFLA_IPTUN_ENCAP_DPORT, |
Alexei Starovoitov | cfc7381 | 2016-09-15 13:00:29 -0700 | [diff] [blame] | 77 | IFLA_IPTUN_COLLECT_METADATA, |
Craig Gallek | 0a473b8 | 2017-04-19 12:30:53 -0400 | [diff] [blame] | 78 | IFLA_IPTUN_FWMARK, |
Nicolas Dichtel | 0974658 | 2012-11-09 06:09:59 +0000 | [diff] [blame] | 79 | __IFLA_IPTUN_MAX, |
| 80 | }; |
| 81 | #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) |
| 82 | |
Tom Herbert | 5632848 | 2014-09-17 12:25:58 -0700 | [diff] [blame] | 83 | enum tunnel_encap_types { |
| 84 | TUNNEL_ENCAP_NONE, |
| 85 | TUNNEL_ENCAP_FOU, |
Tom Herbert | bc1fc39 | 2014-10-03 15:48:10 -0700 | [diff] [blame] | 86 | TUNNEL_ENCAP_GUE, |
Tom Herbert | 5632848 | 2014-09-17 12:25:58 -0700 | [diff] [blame] | 87 | }; |
| 88 | |
| 89 | #define TUNNEL_ENCAP_FLAG_CSUM (1<<0) |
| 90 | #define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1) |
Tom Herbert | b17f709 | 2014-11-04 09:06:56 -0800 | [diff] [blame] | 91 | #define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2) |
Tom Herbert | 5632848 | 2014-09-17 12:25:58 -0700 | [diff] [blame] | 92 | |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 93 | /* SIT-mode i_flags */ |
| 94 | #define SIT_ISATAP 0x0001 |
| 95 | |
| 96 | struct ip_tunnel_prl { |
| 97 | __be32 addr; |
| 98 | __u16 flags; |
| 99 | __u16 __reserved; |
| 100 | __u32 datalen; |
| 101 | __u32 __reserved2; |
| 102 | /* data follows */ |
| 103 | }; |
| 104 | |
| 105 | /* PRL flags */ |
| 106 | #define PRL_DEFAULT 0x0001 |
| 107 | |
| 108 | struct ip_tunnel_6rd { |
| 109 | struct in6_addr prefix; |
| 110 | __be32 relay_prefix; |
| 111 | __u16 prefixlen; |
| 112 | __u16 relay_prefixlen; |
| 113 | }; |
| 114 | |
| 115 | enum { |
| 116 | IFLA_GRE_UNSPEC, |
| 117 | IFLA_GRE_LINK, |
| 118 | IFLA_GRE_IFLAGS, |
| 119 | IFLA_GRE_OFLAGS, |
| 120 | IFLA_GRE_IKEY, |
| 121 | IFLA_GRE_OKEY, |
| 122 | IFLA_GRE_LOCAL, |
| 123 | IFLA_GRE_REMOTE, |
| 124 | IFLA_GRE_TTL, |
| 125 | IFLA_GRE_TOS, |
| 126 | IFLA_GRE_PMTUDISC, |
| 127 | IFLA_GRE_ENCAP_LIMIT, |
| 128 | IFLA_GRE_FLOWINFO, |
| 129 | IFLA_GRE_FLAGS, |
Tom Herbert | 4565e99 | 2014-09-17 12:26:01 -0700 | [diff] [blame] | 130 | IFLA_GRE_ENCAP_TYPE, |
| 131 | IFLA_GRE_ENCAP_FLAGS, |
| 132 | IFLA_GRE_ENCAP_SPORT, |
| 133 | IFLA_GRE_ENCAP_DPORT, |
Pravin B Shelar | 2e15ea3 | 2015-08-07 23:51:42 -0700 | [diff] [blame] | 134 | IFLA_GRE_COLLECT_METADATA, |
Philip Prindeville | 22a59be | 2016-06-14 15:53:02 -0600 | [diff] [blame] | 135 | IFLA_GRE_IGNORE_DF, |
Craig Gallek | 0a473b8 | 2017-04-19 12:30:53 -0400 | [diff] [blame] | 136 | IFLA_GRE_FWMARK, |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 137 | __IFLA_GRE_MAX, |
| 138 | }; |
| 139 | |
| 140 | #define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) |
| 141 | |
| 142 | /* VTI-mode i_flags */ |
Dmitry Popov | efd0f11 | 2014-06-11 15:09:14 +0400 | [diff] [blame] | 143 | #define VTI_ISVTI ((__force __be16)0x0001) |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 144 | |
| 145 | enum { |
| 146 | IFLA_VTI_UNSPEC, |
| 147 | IFLA_VTI_LINK, |
| 148 | IFLA_VTI_IKEY, |
| 149 | IFLA_VTI_OKEY, |
| 150 | IFLA_VTI_LOCAL, |
| 151 | IFLA_VTI_REMOTE, |
Craig Gallek | 0a473b8 | 2017-04-19 12:30:53 -0400 | [diff] [blame] | 152 | IFLA_VTI_FWMARK, |
David Howells | 607ca46 | 2012-10-13 10:46:48 +0100 | [diff] [blame] | 153 | __IFLA_VTI_MAX, |
| 154 | }; |
| 155 | |
| 156 | #define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1) |
| 157 | #endif /* _UAPI_IF_TUNNEL_H_ */ |