JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 1 | /* @(#) $Header: /tcpdump/master/tcpdump/icmp6.h,v 1.18 2007-08-29 02:31:44 mcr Exp $ (LBL) */ |
| 2 | /* NetBSD: icmp6.h,v 1.13 2000/08/03 16:30:37 itojun Exp */ |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 3 | /* $KAME: icmp6.h,v 1.22 2000/08/03 15:25:16 jinmei Exp $ */ |
| 4 | |
| 5 | /* |
| 6 | * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. |
| 7 | * All rights reserved. |
| 8 | * |
| 9 | * Redistribution and use in source and binary forms, with or without |
| 10 | * modification, are permitted provided that the following conditions |
| 11 | * are met: |
| 12 | * 1. Redistributions of source code must retain the above copyright |
| 13 | * notice, this list of conditions and the following disclaimer. |
| 14 | * 2. Redistributions in binary form must reproduce the above copyright |
| 15 | * notice, this list of conditions and the following disclaimer in the |
| 16 | * documentation and/or other materials provided with the distribution. |
| 17 | * 3. Neither the name of the project nor the names of its contributors |
| 18 | * may be used to endorse or promote products derived from this software |
| 19 | * without specific prior written permission. |
| 20 | * |
| 21 | * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND |
| 22 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 24 | * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE |
| 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 27 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 28 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 29 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 30 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 31 | * SUCH DAMAGE. |
| 32 | */ |
| 33 | |
| 34 | /* |
| 35 | * Copyright (c) 1982, 1986, 1993 |
| 36 | * The Regents of the University of California. All rights reserved. |
| 37 | * |
| 38 | * Redistribution and use in source and binary forms, with or without |
| 39 | * modification, are permitted provided that the following conditions |
| 40 | * are met: |
| 41 | * 1. Redistributions of source code must retain the above copyright |
| 42 | * notice, this list of conditions and the following disclaimer. |
| 43 | * 2. Redistributions in binary form must reproduce the above copyright |
| 44 | * notice, this list of conditions and the following disclaimer in the |
| 45 | * documentation and/or other materials provided with the distribution. |
| 46 | * 3. All advertising materials mentioning features or use of this software |
| 47 | * must display the following acknowledgement: |
| 48 | * This product includes software developed by the University of |
| 49 | * California, Berkeley and its contributors. |
| 50 | * 4. Neither the name of the University nor the names of its contributors |
| 51 | * may be used to endorse or promote products derived from this software |
| 52 | * without specific prior written permission. |
| 53 | * |
| 54 | * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND |
| 55 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE |
| 56 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE |
| 57 | * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE |
| 58 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
| 59 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS |
| 60 | * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) |
| 61 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT |
| 62 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY |
| 63 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
| 64 | * SUCH DAMAGE. |
| 65 | * |
| 66 | * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 |
| 67 | */ |
| 68 | |
| 69 | #ifndef _NETINET_ICMP6_H_ |
| 70 | #define _NETINET_ICMP6_H_ |
| 71 | |
| 72 | struct icmp6_hdr { |
| 73 | u_int8_t icmp6_type; /* type field */ |
| 74 | u_int8_t icmp6_code; /* code field */ |
| 75 | u_int16_t icmp6_cksum; /* checksum field */ |
| 76 | union { |
| 77 | u_int32_t icmp6_un_data32[1]; /* type-specific field */ |
| 78 | u_int16_t icmp6_un_data16[2]; /* type-specific field */ |
| 79 | u_int8_t icmp6_un_data8[4]; /* type-specific field */ |
| 80 | } icmp6_dataun; |
| 81 | }; |
| 82 | |
| 83 | #define icmp6_data32 icmp6_dataun.icmp6_un_data32 |
| 84 | #define icmp6_data16 icmp6_dataun.icmp6_un_data16 |
| 85 | #define icmp6_data8 icmp6_dataun.icmp6_un_data8 |
| 86 | #define icmp6_pptr icmp6_data32[0] /* parameter prob */ |
| 87 | #define icmp6_mtu icmp6_data32[0] /* packet too big */ |
| 88 | #define icmp6_id icmp6_data16[0] /* echo request/reply */ |
| 89 | #define icmp6_seq icmp6_data16[1] /* echo request/reply */ |
| 90 | #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ |
| 91 | |
| 92 | #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ |
| 93 | #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ |
| 94 | #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ |
| 95 | #define ICMP6_PARAM_PROB 4 /* ip6 header bad */ |
| 96 | |
| 97 | #define ICMP6_ECHO_REQUEST 128 /* echo service */ |
| 98 | #define ICMP6_ECHO_REPLY 129 /* echo reply */ |
| 99 | #define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ |
| 100 | #define MLD6_LISTENER_QUERY 130 /* multicast listener query */ |
| 101 | #define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ |
| 102 | #define MLD6_LISTENER_REPORT 131 /* multicast listener report */ |
| 103 | #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ |
| 104 | #define MLD6_LISTENER_DONE 132 /* multicast listener done */ |
| 105 | |
| 106 | #define ND_ROUTER_SOLICIT 133 /* router solicitation */ |
| 107 | #define ND_ROUTER_ADVERT 134 /* router advertisement */ |
| 108 | #define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ |
| 109 | #define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisement */ |
| 110 | #define ND_REDIRECT 137 /* redirect */ |
| 111 | |
| 112 | #define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ |
| 113 | |
| 114 | #define ICMP6_WRUREQUEST 139 /* who are you request */ |
| 115 | #define ICMP6_WRUREPLY 140 /* who are you reply */ |
| 116 | #define ICMP6_FQDN_QUERY 139 /* FQDN query */ |
| 117 | #define ICMP6_FQDN_REPLY 140 /* FQDN reply */ |
| 118 | #define ICMP6_NI_QUERY 139 /* node information request */ |
| 119 | #define ICMP6_NI_REPLY 140 /* node information reply */ |
| 120 | #define IND_SOLICIT 141 /* inverse neighbor solicitation */ |
| 121 | #define IND_ADVERT 142 /* inverse neighbor advertisement */ |
| 122 | |
| 123 | #define ICMP6_V2_MEMBERSHIP_REPORT 143 /* v2 membership report */ |
| 124 | #define MLDV2_LISTENER_REPORT 143 /* v2 multicast listener report */ |
| 125 | #define ICMP6_HADISCOV_REQUEST 144 |
| 126 | #define ICMP6_HADISCOV_REPLY 145 |
| 127 | #define ICMP6_MOBILEPREFIX_SOLICIT 146 |
| 128 | #define ICMP6_MOBILEPREFIX_ADVERT 147 |
| 129 | |
| 130 | #define MLD6_MTRACE_RESP 200 /* mtrace response(to sender) */ |
| 131 | #define MLD6_MTRACE 201 /* mtrace messages */ |
| 132 | |
| 133 | #define ICMP6_MAXTYPE 201 |
| 134 | |
| 135 | #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ |
| 136 | #define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ |
| 137 | #define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ |
| 138 | #define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ |
| 139 | #define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ |
| 140 | #define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ |
| 141 | |
| 142 | #define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ |
| 143 | #define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ |
| 144 | |
| 145 | #define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ |
| 146 | #define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ |
| 147 | #define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ |
| 148 | |
| 149 | #define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ |
| 150 | |
| 151 | #define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ |
| 152 | #define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ |
| 153 | #define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ |
| 154 | |
| 155 | #define ICMP6_NI_SUCCESS 0 /* node information successful reply */ |
| 156 | #define ICMP6_NI_REFUSED 1 /* node information request is refused */ |
| 157 | #define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ |
| 158 | |
| 159 | #define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ |
| 160 | #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ |
| 161 | #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ |
| 162 | |
| 163 | /* Used in kernel only */ |
| 164 | #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ |
| 165 | #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ |
| 166 | |
| 167 | /* |
| 168 | * Multicast Listener Discovery |
| 169 | */ |
| 170 | struct mld6_hdr { |
| 171 | struct icmp6_hdr mld6_hdr; |
| 172 | struct in6_addr mld6_addr; /* multicast address */ |
| 173 | }; |
| 174 | |
| 175 | #define mld6_type mld6_hdr.icmp6_type |
| 176 | #define mld6_code mld6_hdr.icmp6_code |
| 177 | #define mld6_cksum mld6_hdr.icmp6_cksum |
| 178 | #define mld6_maxdelay mld6_hdr.icmp6_data16[0] |
| 179 | #define mld6_reserved mld6_hdr.icmp6_data16[1] |
| 180 | |
| 181 | #define MLD_MINLEN 24 |
| 182 | #define MLDV2_MINLEN 28 |
| 183 | |
| 184 | /* |
| 185 | * Neighbor Discovery |
| 186 | */ |
| 187 | |
| 188 | struct nd_router_solicit { /* router solicitation */ |
| 189 | struct icmp6_hdr nd_rs_hdr; |
| 190 | /* could be followed by options */ |
| 191 | }; |
| 192 | |
| 193 | #define nd_rs_type nd_rs_hdr.icmp6_type |
| 194 | #define nd_rs_code nd_rs_hdr.icmp6_code |
| 195 | #define nd_rs_cksum nd_rs_hdr.icmp6_cksum |
| 196 | #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] |
| 197 | |
| 198 | struct nd_router_advert { /* router advertisement */ |
| 199 | struct icmp6_hdr nd_ra_hdr; |
| 200 | u_int32_t nd_ra_reachable; /* reachable time */ |
| 201 | u_int32_t nd_ra_retransmit; /* retransmit timer */ |
| 202 | /* could be followed by options */ |
| 203 | }; |
| 204 | |
| 205 | #define nd_ra_type nd_ra_hdr.icmp6_type |
| 206 | #define nd_ra_code nd_ra_hdr.icmp6_code |
| 207 | #define nd_ra_cksum nd_ra_hdr.icmp6_cksum |
| 208 | #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] |
| 209 | #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] |
| 210 | #define ND_RA_FLAG_MANAGED 0x80 |
| 211 | #define ND_RA_FLAG_OTHER 0x40 |
| 212 | #define ND_RA_FLAG_HOME_AGENT 0x20 |
| 213 | |
| 214 | /* |
| 215 | * Router preference values based on draft-draves-ipngwg-router-selection-01. |
| 216 | * These are non-standard definitions. |
| 217 | */ |
| 218 | #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ |
| 219 | |
| 220 | #define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ |
| 221 | #define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ |
| 222 | #define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ |
| 223 | #define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ |
| 224 | |
| 225 | #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] |
| 226 | |
| 227 | struct nd_neighbor_solicit { /* neighbor solicitation */ |
| 228 | struct icmp6_hdr nd_ns_hdr; |
| 229 | struct in6_addr nd_ns_target; /*target address */ |
| 230 | /* could be followed by options */ |
| 231 | }; |
| 232 | |
| 233 | #define nd_ns_type nd_ns_hdr.icmp6_type |
| 234 | #define nd_ns_code nd_ns_hdr.icmp6_code |
| 235 | #define nd_ns_cksum nd_ns_hdr.icmp6_cksum |
| 236 | #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] |
| 237 | |
| 238 | struct nd_neighbor_advert { /* neighbor advertisement */ |
| 239 | struct icmp6_hdr nd_na_hdr; |
| 240 | struct in6_addr nd_na_target; /* target address */ |
| 241 | /* could be followed by options */ |
| 242 | }; |
| 243 | |
| 244 | #define nd_na_type nd_na_hdr.icmp6_type |
| 245 | #define nd_na_code nd_na_hdr.icmp6_code |
| 246 | #define nd_na_cksum nd_na_hdr.icmp6_cksum |
| 247 | #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] |
| 248 | |
| 249 | #define ND_NA_FLAG_ROUTER 0x80000000 |
| 250 | #define ND_NA_FLAG_SOLICITED 0x40000000 |
| 251 | #define ND_NA_FLAG_OVERRIDE 0x20000000 |
| 252 | |
| 253 | struct nd_redirect { /* redirect */ |
| 254 | struct icmp6_hdr nd_rd_hdr; |
| 255 | struct in6_addr nd_rd_target; /* target address */ |
| 256 | struct in6_addr nd_rd_dst; /* destination address */ |
| 257 | /* could be followed by options */ |
| 258 | }; |
| 259 | |
| 260 | #define nd_rd_type nd_rd_hdr.icmp6_type |
| 261 | #define nd_rd_code nd_rd_hdr.icmp6_code |
| 262 | #define nd_rd_cksum nd_rd_hdr.icmp6_cksum |
| 263 | #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] |
| 264 | |
| 265 | struct nd_opt_hdr { /* Neighbor discovery option header */ |
| 266 | u_int8_t nd_opt_type; |
| 267 | u_int8_t nd_opt_len; |
| 268 | /* followed by option specific data*/ |
| 269 | }; |
| 270 | |
| 271 | #define ND_OPT_SOURCE_LINKADDR 1 |
| 272 | #define ND_OPT_TARGET_LINKADDR 2 |
| 273 | #define ND_OPT_PREFIX_INFORMATION 3 |
| 274 | #define ND_OPT_REDIRECTED_HEADER 4 |
| 275 | #define ND_OPT_MTU 5 |
| 276 | #define ND_OPT_ADVINTERVAL 7 |
| 277 | #define ND_OPT_HOMEAGENT_INFO 8 |
| 278 | #define ND_OPT_ROUTE_INFO 9 /* draft-ietf-ipngwg-router-preference, not officially assigned yet */ |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 279 | #define ND_OPT_RDNSS 25 |
| 280 | #define ND_OPT_DNSSL 31 |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 281 | |
| 282 | struct nd_opt_prefix_info { /* prefix information */ |
| 283 | u_int8_t nd_opt_pi_type; |
| 284 | u_int8_t nd_opt_pi_len; |
| 285 | u_int8_t nd_opt_pi_prefix_len; |
| 286 | u_int8_t nd_opt_pi_flags_reserved; |
| 287 | u_int8_t nd_opt_pi_valid_time[4]; |
| 288 | u_int8_t nd_opt_pi_preferred_time[4]; |
| 289 | u_int8_t nd_opt_pi_reserved2[4]; |
| 290 | struct in6_addr nd_opt_pi_prefix; |
| 291 | }; |
| 292 | |
| 293 | #define ND_OPT_PI_FLAG_ONLINK 0x80 |
| 294 | #define ND_OPT_PI_FLAG_AUTO 0x40 |
| 295 | #define ND_OPT_PI_FLAG_ROUTER 0x20 /*2292bis*/ |
| 296 | |
| 297 | struct nd_opt_rd_hdr { /* redirected header */ |
| 298 | u_int8_t nd_opt_rh_type; |
| 299 | u_int8_t nd_opt_rh_len; |
| 300 | u_int16_t nd_opt_rh_reserved1; |
| 301 | u_int32_t nd_opt_rh_reserved2; |
| 302 | /* followed by IP header and data */ |
| 303 | }; |
| 304 | |
| 305 | struct nd_opt_mtu { /* MTU option */ |
| 306 | u_int8_t nd_opt_mtu_type; |
| 307 | u_int8_t nd_opt_mtu_len; |
| 308 | u_int16_t nd_opt_mtu_reserved; |
| 309 | u_int32_t nd_opt_mtu_mtu; |
| 310 | }; |
| 311 | |
JP Abgrall | 53f17a9 | 2014-02-12 14:02:41 -0800 | [diff] [blame] | 312 | struct nd_opt_rdnss { /* RDNSS RFC 6106 5.1 */ |
| 313 | u_int8_t nd_opt_rdnss_type; |
| 314 | u_int8_t nd_opt_rdnss_len; |
| 315 | u_int16_t nd_opt_rdnss_reserved; |
| 316 | u_int32_t nd_opt_rdnss_lifetime; |
| 317 | struct in6_addr nd_opt_rdnss_addr[1]; /* variable-length */ |
| 318 | }; |
| 319 | |
| 320 | struct nd_opt_dnssl { /* DNSSL RFC 6106 5.2 */ |
| 321 | u_int8_t nd_opt_dnssl_type; |
| 322 | u_int8_t nd_opt_dnssl_len; |
| 323 | u_int16_t nd_opt_dnssl_reserved; |
| 324 | u_int32_t nd_opt_dnssl_lifetime; |
| 325 | /* followed by list of DNS search domains, variable-length */ |
| 326 | }; |
| 327 | |
The Android Open Source Project | 2949f58 | 2009-03-03 19:30:46 -0800 | [diff] [blame] | 328 | struct nd_opt_advinterval { /* Advertisement interval option */ |
| 329 | u_int8_t nd_opt_adv_type; |
| 330 | u_int8_t nd_opt_adv_len; |
| 331 | u_int16_t nd_opt_adv_reserved; |
| 332 | u_int32_t nd_opt_adv_interval; |
| 333 | }; |
| 334 | |
| 335 | struct nd_opt_homeagent_info { /* Home Agent info */ |
| 336 | u_int8_t nd_opt_hai_type; |
| 337 | u_int8_t nd_opt_hai_len; |
| 338 | u_int16_t nd_opt_hai_reserved; |
| 339 | int16_t nd_opt_hai_preference; |
| 340 | u_int16_t nd_opt_hai_lifetime; |
| 341 | }; |
| 342 | |
| 343 | struct nd_opt_route_info { /* route info */ |
| 344 | u_int8_t nd_opt_rti_type; |
| 345 | u_int8_t nd_opt_rti_len; |
| 346 | u_int8_t nd_opt_rti_prefixlen; |
| 347 | u_int8_t nd_opt_rti_flags; |
| 348 | u_int32_t nd_opt_rti_lifetime; |
| 349 | /* prefix follows */ |
| 350 | }; |
| 351 | |
| 352 | /* |
| 353 | * icmp6 namelookup |
| 354 | */ |
| 355 | |
| 356 | struct icmp6_namelookup { |
| 357 | struct icmp6_hdr icmp6_nl_hdr; |
| 358 | u_int8_t icmp6_nl_nonce[8]; |
| 359 | int32_t icmp6_nl_ttl; |
| 360 | #if 0 |
| 361 | u_int8_t icmp6_nl_len; |
| 362 | u_int8_t icmp6_nl_name[3]; |
| 363 | #endif |
| 364 | /* could be followed by options */ |
| 365 | }; |
| 366 | |
| 367 | /* |
| 368 | * icmp6 node information |
| 369 | */ |
| 370 | struct icmp6_nodeinfo { |
| 371 | struct icmp6_hdr icmp6_ni_hdr; |
| 372 | u_int8_t icmp6_ni_nonce[8]; |
| 373 | /* could be followed by reply data */ |
| 374 | }; |
| 375 | |
| 376 | #define ni_type icmp6_ni_hdr.icmp6_type |
| 377 | #define ni_code icmp6_ni_hdr.icmp6_code |
| 378 | #define ni_cksum icmp6_ni_hdr.icmp6_cksum |
| 379 | #define ni_qtype icmp6_ni_hdr.icmp6_data16[0] |
| 380 | #define ni_flags icmp6_ni_hdr.icmp6_data16[1] |
| 381 | |
| 382 | #define NI_QTYPE_NOOP 0 /* NOOP */ |
| 383 | #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ |
| 384 | #define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ |
| 385 | #define NI_QTYPE_DNSNAME 2 /* DNS Name */ |
| 386 | #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ |
| 387 | #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ |
| 388 | |
| 389 | /* network endian */ |
| 390 | #define NI_SUPTYPE_FLAG_COMPRESS ((u_int16_t)htons(0x1)) |
| 391 | #define NI_FQDN_FLAG_VALIDTTL ((u_int16_t)htons(0x1)) |
| 392 | |
| 393 | /* network endian */ |
| 394 | #define NI_NODEADDR_FLAG_TRUNCATE ((u_int16_t)htons(0x1)) |
| 395 | #define NI_NODEADDR_FLAG_ALL ((u_int16_t)htons(0x2)) |
| 396 | #define NI_NODEADDR_FLAG_COMPAT ((u_int16_t)htons(0x4)) |
| 397 | #define NI_NODEADDR_FLAG_LINKLOCAL ((u_int16_t)htons(0x8)) |
| 398 | #define NI_NODEADDR_FLAG_SITELOCAL ((u_int16_t)htons(0x10)) |
| 399 | #define NI_NODEADDR_FLAG_GLOBAL ((u_int16_t)htons(0x20)) |
| 400 | #define NI_NODEADDR_FLAG_ANYCAST ((u_int16_t)htons(0x40)) /* just experimental. not in spec */ |
| 401 | |
| 402 | struct ni_reply_fqdn { |
| 403 | u_int32_t ni_fqdn_ttl; /* TTL */ |
| 404 | u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ |
| 405 | u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ |
| 406 | }; |
| 407 | |
| 408 | /* |
| 409 | * Router Renumbering. as router-renum-08.txt |
| 410 | */ |
| 411 | struct icmp6_router_renum { /* router renumbering header */ |
| 412 | struct icmp6_hdr rr_hdr; |
| 413 | u_int8_t rr_segnum; |
| 414 | u_int8_t rr_flags; |
| 415 | u_int16_t rr_maxdelay; |
| 416 | u_int32_t rr_reserved; |
| 417 | }; |
| 418 | #define ICMP6_RR_FLAGS_TEST 0x80 |
| 419 | #define ICMP6_RR_FLAGS_REQRESULT 0x40 |
| 420 | #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 |
| 421 | #define ICMP6_RR_FLAGS_SPECSITE 0x10 |
| 422 | #define ICMP6_RR_FLAGS_PREVDONE 0x08 |
| 423 | |
| 424 | #define rr_type rr_hdr.icmp6_type |
| 425 | #define rr_code rr_hdr.icmp6_code |
| 426 | #define rr_cksum rr_hdr.icmp6_cksum |
| 427 | #define rr_seqnum rr_hdr.icmp6_data32[0] |
| 428 | |
| 429 | struct rr_pco_match { /* match prefix part */ |
| 430 | u_int8_t rpm_code; |
| 431 | u_int8_t rpm_len; |
| 432 | u_int8_t rpm_ordinal; |
| 433 | u_int8_t rpm_matchlen; |
| 434 | u_int8_t rpm_minlen; |
| 435 | u_int8_t rpm_maxlen; |
| 436 | u_int16_t rpm_reserved; |
| 437 | struct in6_addr rpm_prefix; |
| 438 | }; |
| 439 | |
| 440 | #define RPM_PCO_ADD 1 |
| 441 | #define RPM_PCO_CHANGE 2 |
| 442 | #define RPM_PCO_SETGLOBAL 3 |
| 443 | #define RPM_PCO_MAX 4 |
| 444 | |
| 445 | struct rr_pco_use { /* use prefix part */ |
| 446 | u_int8_t rpu_uselen; |
| 447 | u_int8_t rpu_keeplen; |
| 448 | u_int8_t rpu_ramask; |
| 449 | u_int8_t rpu_raflags; |
| 450 | u_int32_t rpu_vltime; |
| 451 | u_int32_t rpu_pltime; |
| 452 | u_int32_t rpu_flags; |
| 453 | struct in6_addr rpu_prefix; |
| 454 | }; |
| 455 | #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 |
| 456 | #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 |
| 457 | |
| 458 | /* network endian */ |
| 459 | #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME ((u_int32_t)htonl(0x80000000)) |
| 460 | #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME ((u_int32_t)htonl(0x40000000)) |
| 461 | |
| 462 | struct rr_result { /* router renumbering result message */ |
| 463 | u_int16_t rrr_flags; |
| 464 | u_int8_t rrr_ordinal; |
| 465 | u_int8_t rrr_matchedlen; |
| 466 | u_int32_t rrr_ifid; |
| 467 | struct in6_addr rrr_prefix; |
| 468 | }; |
| 469 | /* network endian */ |
| 470 | #define ICMP6_RR_RESULT_FLAGS_OOB ((u_int16_t)htons(0x0002)) |
| 471 | #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN ((u_int16_t)htons(0x0001)) |
| 472 | |
| 473 | #endif /* not _NETINET_ICMP6_H_ */ |