ipv6.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. #ifndef _UAPI_IPV6_H
  3. #define _UAPI_IPV6_H
  4. #include <linux/libc-compat.h>
  5. #include <linux/types.h>
  6. #include <linux/in6.h>
  7. #include <asm/byteorder.h>
  8. /* The latest drafts declared increase in minimal mtu up to 1280. */
  9. #define IPV6_MIN_MTU 1280
  10. /*
  11. * Advanced API
  12. * source interface/address selection, source routing, etc...
  13. * *under construction*
  14. */
  15. #if __UAPI_DEF_IN6_PKTINFO
  16. struct in6_pktinfo {
  17. struct in6_addr ipi6_addr;
  18. int ipi6_ifindex;
  19. };
  20. #endif
  21. #if __UAPI_DEF_IP6_MTUINFO
  22. struct ip6_mtuinfo {
  23. struct sockaddr_in6 ip6m_addr;
  24. __u32 ip6m_mtu;
  25. };
  26. #endif
  27. struct in6_ifreq {
  28. struct in6_addr ifr6_addr;
  29. __u32 ifr6_prefixlen;
  30. int ifr6_ifindex;
  31. };
  32. #define IPV6_SRCRT_STRICT 0x01 /* Deprecated; will be removed */
  33. #define IPV6_SRCRT_TYPE_0 0 /* Deprecated; will be removed */
  34. #define IPV6_SRCRT_TYPE_2 2 /* IPv6 type 2 Routing Header */
  35. #define IPV6_SRCRT_TYPE_4 4 /* Segment Routing with IPv6 */
  36. /*
  37. * routing header
  38. */
  39. struct ipv6_rt_hdr {
  40. __u8 nexthdr;
  41. __u8 hdrlen;
  42. __u8 type;
  43. __u8 segments_left;
  44. /*
  45. * type specific data
  46. * variable length field
  47. */
  48. };
  49. struct ipv6_opt_hdr {
  50. __u8 nexthdr;
  51. __u8 hdrlen;
  52. /*
  53. * TLV encoded option data follows.
  54. */
  55. } __attribute__((packed)); /* required for some archs */
  56. #define ipv6_destopt_hdr ipv6_opt_hdr
  57. #define ipv6_hopopt_hdr ipv6_opt_hdr
  58. /* Router Alert option values (RFC2711) */
  59. #define IPV6_OPT_ROUTERALERT_MLD 0x0000 /* MLD(RFC2710) */
  60. /*
  61. * routing header type 0 (used in cmsghdr struct)
  62. */
  63. struct rt0_hdr {
  64. struct ipv6_rt_hdr rt_hdr;
  65. __u32 reserved;
  66. struct in6_addr addr[0];
  67. #define rt0_type rt_hdr.type
  68. };
  69. /*
  70. * routing header type 2
  71. */
  72. struct rt2_hdr {
  73. struct ipv6_rt_hdr rt_hdr;
  74. __u32 reserved;
  75. struct in6_addr addr;
  76. #define rt2_type rt_hdr.type
  77. };
  78. /*
  79. * home address option in destination options header
  80. */
  81. struct ipv6_destopt_hao {
  82. __u8 type;
  83. __u8 length;
  84. struct in6_addr addr;
  85. } __attribute__((packed));
  86. /*
  87. * IPv6 fixed header
  88. *
  89. * BEWARE, it is incorrect. The first 4 bits of flow_lbl
  90. * are glued to priority now, forming "class".
  91. */
  92. struct ipv6hdr {
  93. #if defined(__LITTLE_ENDIAN_BITFIELD)
  94. __u8 priority:4,
  95. version:4;
  96. #elif defined(__BIG_ENDIAN_BITFIELD)
  97. __u8 version:4,
  98. priority:4;
  99. #else
  100. #error "Please fix <asm/byteorder.h>"
  101. #endif
  102. __u8 flow_lbl[3];
  103. __be16 payload_len;
  104. __u8 nexthdr;
  105. __u8 hop_limit;
  106. struct in6_addr saddr;
  107. struct in6_addr daddr;
  108. };
  109. /* index values for the variables in ipv6_devconf */
  110. enum {
  111. DEVCONF_FORWARDING = 0,
  112. DEVCONF_HOPLIMIT,
  113. DEVCONF_MTU6,
  114. DEVCONF_ACCEPT_RA,
  115. DEVCONF_ACCEPT_REDIRECTS,
  116. DEVCONF_AUTOCONF,
  117. DEVCONF_DAD_TRANSMITS,
  118. DEVCONF_RTR_SOLICITS,
  119. DEVCONF_RTR_SOLICIT_INTERVAL,
  120. DEVCONF_RTR_SOLICIT_DELAY,
  121. DEVCONF_USE_TEMPADDR,
  122. DEVCONF_TEMP_VALID_LFT,
  123. DEVCONF_TEMP_PREFERED_LFT,
  124. DEVCONF_REGEN_MAX_RETRY,
  125. DEVCONF_MAX_DESYNC_FACTOR,
  126. DEVCONF_MAX_ADDRESSES,
  127. DEVCONF_FORCE_MLD_VERSION,
  128. DEVCONF_ACCEPT_RA_DEFRTR,
  129. DEVCONF_ACCEPT_RA_PINFO,
  130. DEVCONF_ACCEPT_RA_RTR_PREF,
  131. DEVCONF_RTR_PROBE_INTERVAL,
  132. DEVCONF_ACCEPT_RA_RT_INFO_MAX_PLEN,
  133. DEVCONF_PROXY_NDP,
  134. DEVCONF_OPTIMISTIC_DAD,
  135. DEVCONF_ACCEPT_SOURCE_ROUTE,
  136. DEVCONF_MC_FORWARDING,
  137. DEVCONF_DISABLE_IPV6,
  138. DEVCONF_ACCEPT_DAD,
  139. DEVCONF_FORCE_TLLAO,
  140. DEVCONF_NDISC_NOTIFY,
  141. DEVCONF_MLDV1_UNSOLICITED_REPORT_INTERVAL,
  142. DEVCONF_MLDV2_UNSOLICITED_REPORT_INTERVAL,
  143. DEVCONF_SUPPRESS_FRAG_NDISC,
  144. DEVCONF_ACCEPT_RA_FROM_LOCAL,
  145. DEVCONF_USE_OPTIMISTIC,
  146. DEVCONF_ACCEPT_RA_MTU,
  147. DEVCONF_STABLE_SECRET,
  148. DEVCONF_USE_OIF_ADDRS_ONLY,
  149. DEVCONF_ACCEPT_RA_MIN_HOP_LIMIT,
  150. DEVCONF_IGNORE_ROUTES_WITH_LINKDOWN,
  151. DEVCONF_DROP_UNICAST_IN_L2_MULTICAST,
  152. DEVCONF_DROP_UNSOLICITED_NA,
  153. DEVCONF_KEEP_ADDR_ON_DOWN,
  154. DEVCONF_RTR_SOLICIT_MAX_INTERVAL,
  155. DEVCONF_SEG6_ENABLED,
  156. DEVCONF_SEG6_REQUIRE_HMAC,
  157. DEVCONF_ENHANCED_DAD,
  158. DEVCONF_ADDR_GEN_MODE,
  159. DEVCONF_DISABLE_POLICY,
  160. DEVCONF_ACCEPT_RA_RT_INFO_MIN_PLEN,
  161. DEVCONF_NDISC_TCLASS,
  162. DEVCONF_MAX
  163. };
  164. #endif /* _UAPI_IPV6_H */