icmpv6.h 3.9 KB

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