ipv6.h 3.5 KB

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