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