if_tunnel.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_IF_TUNNEL_H_
  3. #define _UAPI_IF_TUNNEL_H_
  4. #include <linux/types.h>
  5. #include <linux/if.h>
  6. #include <linux/ip.h>
  7. #include <linux/in6.h>
  8. #include <asm/byteorder.h>
  9. #define SIOCGETTUNNEL (SIOCDEVPRIVATE + 0)
  10. #define SIOCADDTUNNEL (SIOCDEVPRIVATE + 1)
  11. #define SIOCDELTUNNEL (SIOCDEVPRIVATE + 2)
  12. #define SIOCCHGTUNNEL (SIOCDEVPRIVATE + 3)
  13. #define SIOCGETPRL (SIOCDEVPRIVATE + 4)
  14. #define SIOCADDPRL (SIOCDEVPRIVATE + 5)
  15. #define SIOCDELPRL (SIOCDEVPRIVATE + 6)
  16. #define SIOCCHGPRL (SIOCDEVPRIVATE + 7)
  17. #define SIOCGET6RD (SIOCDEVPRIVATE + 8)
  18. #define SIOCADD6RD (SIOCDEVPRIVATE + 9)
  19. #define SIOCDEL6RD (SIOCDEVPRIVATE + 10)
  20. #define SIOCCHG6RD (SIOCDEVPRIVATE + 11)
  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)
  27. #define GRE_ACK __cpu_to_be16(0x0080)
  28. #define GRE_FLAGS __cpu_to_be16(0x0078)
  29. #define GRE_VERSION __cpu_to_be16(0x0007)
  30. #define GRE_IS_CSUM(f) ((f) & GRE_CSUM)
  31. #define GRE_IS_ROUTING(f) ((f) & GRE_ROUTING)
  32. #define GRE_IS_KEY(f) ((f) & GRE_KEY)
  33. #define GRE_IS_SEQ(f) ((f) & GRE_SEQ)
  34. #define GRE_IS_STRICT(f) ((f) & GRE_STRICT)
  35. #define GRE_IS_REC(f) ((f) & GRE_REC)
  36. #define GRE_IS_ACK(f) ((f) & GRE_ACK)
  37. #define GRE_VERSION_0 __cpu_to_be16(0x0000)
  38. #define GRE_VERSION_1 __cpu_to_be16(0x0001)
  39. #define GRE_PROTO_PPP __cpu_to_be16(0x880b)
  40. #define GRE_PPTP_KEY_MASK __cpu_to_be32(0xffff)
  41. struct ip_tunnel_parm {
  42. char name[IFNAMSIZ];
  43. int link;
  44. __be16 i_flags;
  45. __be16 o_flags;
  46. __be32 i_key;
  47. __be32 o_key;
  48. struct iphdr iph;
  49. };
  50. enum {
  51. IFLA_IPTUN_UNSPEC,
  52. IFLA_IPTUN_LINK,
  53. IFLA_IPTUN_LOCAL,
  54. IFLA_IPTUN_REMOTE,
  55. IFLA_IPTUN_TTL,
  56. IFLA_IPTUN_TOS,
  57. IFLA_IPTUN_ENCAP_LIMIT,
  58. IFLA_IPTUN_FLOWINFO,
  59. IFLA_IPTUN_FLAGS,
  60. IFLA_IPTUN_PROTO,
  61. IFLA_IPTUN_PMTUDISC,
  62. IFLA_IPTUN_6RD_PREFIX,
  63. IFLA_IPTUN_6RD_RELAY_PREFIX,
  64. IFLA_IPTUN_6RD_PREFIXLEN,
  65. IFLA_IPTUN_6RD_RELAY_PREFIXLEN,
  66. IFLA_IPTUN_ENCAP_TYPE,
  67. IFLA_IPTUN_ENCAP_FLAGS,
  68. IFLA_IPTUN_ENCAP_SPORT,
  69. IFLA_IPTUN_ENCAP_DPORT,
  70. IFLA_IPTUN_COLLECT_METADATA,
  71. IFLA_IPTUN_FWMARK,
  72. __IFLA_IPTUN_MAX,
  73. };
  74. #define IFLA_IPTUN_MAX (__IFLA_IPTUN_MAX - 1)
  75. enum tunnel_encap_types {
  76. TUNNEL_ENCAP_NONE,
  77. TUNNEL_ENCAP_FOU,
  78. TUNNEL_ENCAP_GUE,
  79. TUNNEL_ENCAP_MPLS,
  80. };
  81. #define TUNNEL_ENCAP_FLAG_CSUM (1<<0)
  82. #define TUNNEL_ENCAP_FLAG_CSUM6 (1<<1)
  83. #define TUNNEL_ENCAP_FLAG_REMCSUM (1<<2)
  84. /* SIT-mode i_flags */
  85. #define SIT_ISATAP 0x0001
  86. struct ip_tunnel_prl {
  87. __be32 addr;
  88. __u16 flags;
  89. __u16 __reserved;
  90. __u32 datalen;
  91. __u32 __reserved2;
  92. /* data follows */
  93. };
  94. /* PRL flags */
  95. #define PRL_DEFAULT 0x0001
  96. struct ip_tunnel_6rd {
  97. struct in6_addr prefix;
  98. __be32 relay_prefix;
  99. __u16 prefixlen;
  100. __u16 relay_prefixlen;
  101. };
  102. enum {
  103. IFLA_GRE_UNSPEC,
  104. IFLA_GRE_LINK,
  105. IFLA_GRE_IFLAGS,
  106. IFLA_GRE_OFLAGS,
  107. IFLA_GRE_IKEY,
  108. IFLA_GRE_OKEY,
  109. IFLA_GRE_LOCAL,
  110. IFLA_GRE_REMOTE,
  111. IFLA_GRE_TTL,
  112. IFLA_GRE_TOS,
  113. IFLA_GRE_PMTUDISC,
  114. IFLA_GRE_ENCAP_LIMIT,
  115. IFLA_GRE_FLOWINFO,
  116. IFLA_GRE_FLAGS,
  117. IFLA_GRE_ENCAP_TYPE,
  118. IFLA_GRE_ENCAP_FLAGS,
  119. IFLA_GRE_ENCAP_SPORT,
  120. IFLA_GRE_ENCAP_DPORT,
  121. IFLA_GRE_COLLECT_METADATA,
  122. IFLA_GRE_IGNORE_DF,
  123. IFLA_GRE_FWMARK,
  124. IFLA_GRE_ERSPAN_INDEX,
  125. IFLA_GRE_ERSPAN_VER,
  126. IFLA_GRE_ERSPAN_DIR,
  127. IFLA_GRE_ERSPAN_HWID,
  128. __IFLA_GRE_MAX,
  129. };
  130. #define IFLA_GRE_MAX (__IFLA_GRE_MAX - 1)
  131. /* VTI-mode i_flags */
  132. #define VTI_ISVTI ((__force __be16)0x0001)
  133. enum {
  134. IFLA_VTI_UNSPEC,
  135. IFLA_VTI_LINK,
  136. IFLA_VTI_IKEY,
  137. IFLA_VTI_OKEY,
  138. IFLA_VTI_LOCAL,
  139. IFLA_VTI_REMOTE,
  140. IFLA_VTI_FWMARK,
  141. __IFLA_VTI_MAX,
  142. };
  143. #define IFLA_VTI_MAX (__IFLA_VTI_MAX - 1)
  144. #endif /* _UAPI_IF_TUNNEL_H_ */