icmpv6.h 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. #ifndef _UAPI_LINUX_ICMPV6_H
  2. #define _UAPI_LINUX_ICMPV6_H
  3. #include <linux/types.h>
  4. #include <asm/byteorder.h>
  5. struct icmp6hdr {
  6. __u8 icmp6_type;
  7. __u8 icmp6_code;
  8. __sum16 icmp6_cksum;
  9. union {
  10. __be32 un_data32[1];
  11. __be16 un_data16[2];
  12. __u8 un_data8[4];
  13. struct icmpv6_echo {
  14. __be16 identifier;
  15. __be16 sequence;
  16. } u_echo;
  17. struct icmpv6_nd_advt {
  18. #if defined(__LITTLE_ENDIAN_BITFIELD)
  19. __u32 reserved:5,
  20. override:1,
  21. solicited:1,
  22. router:1,
  23. reserved2:24;
  24. #elif defined(__BIG_ENDIAN_BITFIELD)
  25. __u32 router:1,
  26. solicited:1,
  27. override:1,
  28. reserved:29;
  29. #else
  30. #error "Please fix <asm/byteorder.h>"
  31. #endif
  32. } u_nd_advt;
  33. struct icmpv6_nd_ra {
  34. __u8 hop_limit;
  35. #if defined(__LITTLE_ENDIAN_BITFIELD)
  36. __u8 reserved:3,
  37. router_pref:2,
  38. home_agent:1,
  39. other:1,
  40. managed:1;
  41. #elif defined(__BIG_ENDIAN_BITFIELD)
  42. __u8 managed:1,
  43. other:1,
  44. home_agent:1,
  45. router_pref:2,
  46. reserved:3;
  47. #else
  48. #error "Please fix <asm/byteorder.h>"
  49. #endif
  50. __be16 rt_lifetime;
  51. } u_nd_ra;
  52. } icmp6_dataun;
  53. #define icmp6_identifier icmp6_dataun.u_echo.identifier
  54. #define icmp6_sequence icmp6_dataun.u_echo.sequence
  55. #define icmp6_pointer icmp6_dataun.un_data32[0]
  56. #define icmp6_mtu icmp6_dataun.un_data32[0]
  57. #define icmp6_unused icmp6_dataun.un_data32[0]
  58. #define icmp6_maxdelay icmp6_dataun.un_data16[0]
  59. #define icmp6_router icmp6_dataun.u_nd_advt.router
  60. #define icmp6_solicited icmp6_dataun.u_nd_advt.solicited
  61. #define icmp6_override icmp6_dataun.u_nd_advt.override
  62. #define icmp6_ndiscreserved icmp6_dataun.u_nd_advt.reserved
  63. #define icmp6_hop_limit icmp6_dataun.u_nd_ra.hop_limit
  64. #define icmp6_addrconf_managed icmp6_dataun.u_nd_ra.managed
  65. #define icmp6_addrconf_other icmp6_dataun.u_nd_ra.other
  66. #define icmp6_rt_lifetime icmp6_dataun.u_nd_ra.rt_lifetime
  67. #define icmp6_router_pref icmp6_dataun.u_nd_ra.router_pref
  68. };
  69. #define ICMPV6_ROUTER_PREF_LOW 0x3
  70. #define ICMPV6_ROUTER_PREF_MEDIUM 0x0
  71. #define ICMPV6_ROUTER_PREF_HIGH 0x1
  72. #define ICMPV6_ROUTER_PREF_INVALID 0x2
  73. #define ICMPV6_DEST_UNREACH 1
  74. #define ICMPV6_PKT_TOOBIG 2
  75. #define ICMPV6_TIME_EXCEED 3
  76. #define ICMPV6_PARAMPROB 4
  77. #define ICMPV6_INFOMSG_MASK 0x80
  78. #define ICMPV6_ECHO_REQUEST 128
  79. #define ICMPV6_ECHO_REPLY 129
  80. #define ICMPV6_MGM_QUERY 130
  81. #define ICMPV6_MGM_REPORT 131
  82. #define ICMPV6_MGM_REDUCTION 132
  83. #define ICMPV6_NI_QUERY 139
  84. #define ICMPV6_NI_REPLY 140
  85. #define ICMPV6_MLD2_REPORT 143
  86. #define ICMPV6_DHAAD_REQUEST 144
  87. #define ICMPV6_DHAAD_REPLY 145
  88. #define ICMPV6_MOBILE_PREFIX_SOL 146
  89. #define ICMPV6_MOBILE_PREFIX_ADV 147
  90. /*
  91. * Codes for Destination Unreachable
  92. */
  93. #define ICMPV6_NOROUTE 0
  94. #define ICMPV6_ADM_PROHIBITED 1
  95. #define ICMPV6_NOT_NEIGHBOUR 2
  96. #define ICMPV6_ADDR_UNREACH 3
  97. #define ICMPV6_PORT_UNREACH 4
  98. #define ICMPV6_POLICY_FAIL 5
  99. #define ICMPV6_REJECT_ROUTE 6
  100. /*
  101. * Codes for Time Exceeded
  102. */
  103. #define ICMPV6_EXC_HOPLIMIT 0
  104. #define ICMPV6_EXC_FRAGTIME 1
  105. /*
  106. * Codes for Parameter Problem
  107. */
  108. #define ICMPV6_HDR_FIELD 0
  109. #define ICMPV6_UNK_NEXTHDR 1
  110. #define ICMPV6_UNK_OPTION 2
  111. /*
  112. * constants for (set|get)sockopt
  113. */
  114. #define ICMPV6_FILTER 1
  115. /*
  116. * ICMPV6 filter
  117. */
  118. #define ICMPV6_FILTER_BLOCK 1
  119. #define ICMPV6_FILTER_PASS 2
  120. #define ICMPV6_FILTER_BLOCKOTHERS 3
  121. #define ICMPV6_FILTER_PASSONLY 4
  122. struct icmp6_filter {
  123. __u32 data[8];
  124. };
  125. /*
  126. * Definitions for MLDv2
  127. */
  128. #define MLD2_MODE_IS_INCLUDE 1
  129. #define MLD2_MODE_IS_EXCLUDE 2
  130. #define MLD2_CHANGE_TO_INCLUDE 3
  131. #define MLD2_CHANGE_TO_EXCLUDE 4
  132. #define MLD2_ALLOW_NEW_SOURCES 5
  133. #define MLD2_BLOCK_OLD_SOURCES 6
  134. #define MLD2_ALL_MCR_INIT { { { 0xff,0x02,0,0,0,0,0,0,0,0,0,0,0,0,0,0x16 } } }
  135. #endif /* _UAPI_LINUX_ICMPV6_H */