1 /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */ 2 #ifndef _IF_TUNNEL_H_ 3 #define _IF_TUNNEL_H_ 4 5 #include <linux/types.h> 6 #include <linux/if.h> 7 #include <linux/ip.h> 8 #include <linux/in6.h> 9 #include <asm/byteorder.h> 10 11 12 #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0) 13 #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1) 14 #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2) 15 #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3) 16 #define SIOCGETPRL (SIOCDEVPRIVATE + 4) 17 #define SIOCADDPRL (SIOCDEVPRIVATE + 5) 18 #define SIOCDELPRL (SIOCDEVPRIVATE + 6) 19 #define SIOCCHGPRL (SIOCDEVPRIVATE + 7) 20 #define SIOCGET6RD (SIOCDEVPRIVATE + 8) 21 #define SIOCADD6RD (SIOCDEVPRIVATE + 9) 22 #define SIOCDEL6RD (SIOCDEVPRIVATE + 10) 23 #define SIOCCHG6RD (SIOCDEVPRIVATE + 11) 24 25 #define GRE_CSUM __cpu_to_be16(0x8000) 26 #define GRE_ROUTING __cpu_to_be16(0x4000) 27 #define GRE_KEY __cpu_to_be16(0x2000) 28 #define GRE_SEQ __cpu_to_be16(0x1000) 29 #define GRE_STRICT __cpu_to_be16(0x0800) 30 #define GRE_REC __cpu_to_be16(0x0700) 31 #define GRE_ACK __cpu_to_be16(0x0080) 32 #define GRE_FLAGS __cpu_to_be16(0x0078) 33 #define GRE_VERSION __cpu_to_be16(0x0007) 34 35 #define GRE_IS_CSUM(f) ((f) & GRE_CSUM) 36 #define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING) 37 #define GRE_IS_KEY(f) ((f) & GRE_KEY) 38 #define GRE_IS_SEQ(f) ((f) & GRE_SEQ) 39 #define GRE_IS_STRICT(f) ((f) & GRE_STRICT) 40 #define GRE_IS_REC(f) ((f) & GRE_REC) 41 #define GRE_IS_ACK(f) ((f) & GRE_ACK) 42 43 #define GRE_VERSION_0 __cpu_to_be16(0x0000) 44 #define GRE_VERSION_1 __cpu_to_be16(0x0001) 45 #define GRE_PROTO_PPP __cpu_to_be16(0x880b) 46 #define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff) 47 48 struct ip_tunnel_parm { 49 char name[IFNAMSIZ]; 50 int link; 51 __be16 i_flags; 52 __be16 o_flags; 53 __be32 i_key; 54 __be32 o_key; 55 struct iphdr iph; 56 }; 57 58 enum { 59 IFLA_IPTUN_UNSPEC, 60 IFLA_IPTUN_LINK, 61 IFLA_IPTUN_LOCAL, 62 IFLA_IPTUN_REMOTE, 63 IFLA_IPTUN_TTL, 64 IFLA_IPTUN_TOS, 65 IFLA_IPTUN_ENCAP_LIMIT, 66 IFLA_IPTUN_FLOWINFO, 67 IFLA_IPTUN_FLAGS, 68 IFLA_IPTUN_PROTO, 69 IFLA_IPTUN_PMTUDISC, 70 IFLA_IPTUN_6RD_PREFIX, 71 IFLA_IPTUN_6RD_RELAY_PREFIX, 72 IFLA_IPTUN_6RD_PREFIXLEN, 73 IFLA_IPTUN_6RD_RELAY_PREFIXLEN, 74 IFLA_IPTUN_ENCAP_TYPE, 75 IFLA_IPTUN_ENCAP_FLAGS, 76 IFLA_IPTUN_ENCAP_SPORT, 77 IFLA_IPTUN_ENCAP_DPORT, 78 IFLA_IPTUN_COLLECT_METADATA, 79 IFLA_IPTUN_FWMARK, 80 __IFLA_IPTUN_MAX, 81 }; 82 #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1) 83 84 enum tunnel_encap_types { 85 TUNNEL_ENCAP_NONE, 86 TUNNEL_ENCAP_FOU, 87 TUNNEL_ENCAP_GUE, 88 }; 89 90 #define TUNNEL_ENCAP_FLAG_CSUM (1<<0) 91 #define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1) 92 #define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2) 93 94 /* SIT-mode i_flags */ 95 #define SIT_ISATAP 0x0001 96 97 struct ip_tunnel_prl { 98 __be32 addr; 99 __u16 flags; 100 __u16 __reserved; 101 __u32 datalen; 102 __u32 __reserved2; 103 /* data follows */ 104 }; 105 106 /* PRL flags */ 107 #define PRL_DEFAULT 0x0001 108 109 struct ip_tunnel_6rd { 110 struct in6_addr prefix; 111 __be32 relay_prefix; 112 __u16 prefixlen; 113 __u16 relay_prefixlen; 114 }; 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_MAX, 140 }; 141 142 #define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1) 143 144 /* VTI-mode i_flags */ 145 #define VTI_ISVTI ((__be16)0x0001) 146 147 enum { 148 IFLA_VTI_UNSPEC, 149 IFLA_VTI_LINK, 150 IFLA_VTI_IKEY, 151 IFLA_VTI_OKEY, 152 IFLA_VTI_LOCAL, 153 IFLA_VTI_REMOTE, 154 IFLA_VTI_FWMARK, 155 __IFLA_VTI_MAX, 156 }; 157 158 #define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1) 159 #endif /* _IF_TUNNEL_H_ */ 160