1 /* $NetBSD: icmp6.h,v 1.47 2013/07/01 12:43:15 christos Exp $ */ 2 /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ 3 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. Neither the name of the University nor the names of its contributors 47 * may be used to endorse or promote products derived from this software 48 * without specific prior written permission. 49 * 50 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 51 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 52 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 53 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 54 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 55 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 56 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 57 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 58 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 59 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 60 * SUCH DAMAGE. 61 * 62 * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 63 */ 64 65 #ifndef _NETINET_ICMP6_H_ 66 #define _NETINET_ICMP6_H_ 67 68 #include <sys/cdefs.h> 69 70 #include <netinet/in.h> /* android-added: glibc source compatibility. */ 71 72 #define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) 73 - sizeof(struct icmp6_hdr) */ 74 75 struct icmp6_hdr { 76 u_int8_t icmp6_type; /* type field */ 77 u_int8_t icmp6_code; /* code field */ 78 u_int16_t icmp6_cksum; /* checksum field */ 79 union { 80 u_int32_t icmp6_un_data32[1]; /* type-specific field */ 81 u_int16_t icmp6_un_data16[2]; /* type-specific field */ 82 u_int8_t icmp6_un_data8[4]; /* type-specific field */ 83 } icmp6_dataun; 84 } __packed; 85 86 #define icmp6_data32 icmp6_dataun.icmp6_un_data32 87 #define icmp6_data16 icmp6_dataun.icmp6_un_data16 88 #define icmp6_data8 icmp6_dataun.icmp6_un_data8 89 #define icmp6_pptr icmp6_data32[0] /* parameter prob */ 90 #define icmp6_mtu icmp6_data32[0] /* packet too big */ 91 #define icmp6_id icmp6_data16[0] /* echo request/reply */ 92 #define icmp6_seq icmp6_data16[1] /* echo request/reply */ 93 #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ 94 95 #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ 96 #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ 97 #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ 98 #define ICMP6_PARAM_PROB 4 /* ip6 header bad */ 99 100 #define ICMP6_ECHO_REQUEST 128 /* echo service */ 101 #define ICMP6_ECHO_REPLY 129 /* echo reply */ 102 #define MLD_LISTENER_QUERY 130 /* multicast listener query */ 103 #define MLD_LISTENER_REPORT 131 /* multicast listener report */ 104 #define MLD_LISTENER_DONE 132 /* multicast listener done */ 105 #define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */ 106 107 /* RFC2292 decls */ 108 #define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ 109 #define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ 110 #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ 111 112 #define ND_ROUTER_SOLICIT 133 /* router solicitation */ 113 #define ND_ROUTER_ADVERT 134 /* router advertisement */ 114 #define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ 115 #define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisement */ 116 #define ND_REDIRECT 137 /* redirect */ 117 118 #define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ 119 120 #define ICMP6_WRUREQUEST 139 /* who are you request */ 121 #define ICMP6_WRUREPLY 140 /* who are you reply */ 122 #define ICMP6_FQDN_QUERY 139 /* FQDN query */ 123 #define ICMP6_FQDN_REPLY 140 /* FQDN reply */ 124 #define ICMP6_NI_QUERY 139 /* node information request */ 125 #define ICMP6_NI_REPLY 140 /* node information reply */ 126 #define MLDV2_LISTENER_REPORT 143 /* RFC3810 listener report */ 127 128 /* The definitions below are experimental. TBA */ 129 #define MLD_MTRACE_RESP 200 /* mtrace response(to sender) */ 130 #define MLD_MTRACE 201 /* mtrace messages */ 131 132 #define ICMP6_MAXTYPE 201 133 134 #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ 135 #define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ 136 #define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ 137 #define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ 138 #define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ 139 #define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ 140 #define ICMP6_DST_UNREACH_POLICY 5 /* source address failed ingress/egress policy */ 141 #define ICMP6_DST_UNREACH_REJROUTE 6 /* reject route to destination */ 142 #define ICMP6_DST_UNREACH_SOURCERT 7 /* error in source routing header */ 143 144 #define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ 145 #define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ 146 147 #define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ 148 #define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ 149 #define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ 150 151 #define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ 152 153 #define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ 154 #define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ 155 #define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ 156 157 #define ICMP6_NI_SUCCESS 0 /* node information successful reply */ 158 #define ICMP6_NI_REFUSED 1 /* node information request is refused */ 159 #define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ 160 161 #define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ 162 #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ 163 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ 164 165 /* Used in kernel only */ 166 #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ 167 #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ 168 169 /* 170 * Multicast Listener Discovery 171 */ 172 struct mld_hdr { 173 struct icmp6_hdr mld_icmp6_hdr; 174 struct in6_addr mld_addr; /* multicast address */ 175 } __packed; 176 177 /* shortcut macro definitions */ 178 #define mld_type mld_icmp6_hdr.icmp6_type 179 #define mld_code mld_icmp6_hdr.icmp6_code 180 #define mld_cksum mld_icmp6_hdr.icmp6_cksum 181 #define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] 182 #define mld_reserved mld_icmp6_hdr.icmp6_data16[1] 183 184 #define MLD_MINLEN 24 185 186 /* 187 * Neighbor Discovery 188 */ 189 190 struct nd_router_solicit { /* router solicitation */ 191 struct icmp6_hdr nd_rs_hdr; 192 /* could be followed by options */ 193 } __packed; 194 195 #define nd_rs_type nd_rs_hdr.icmp6_type 196 #define nd_rs_code nd_rs_hdr.icmp6_code 197 #define nd_rs_cksum nd_rs_hdr.icmp6_cksum 198 #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] 199 200 struct nd_router_advert { /* router advertisement */ 201 struct icmp6_hdr nd_ra_hdr; 202 u_int32_t nd_ra_reachable; /* reachable time */ 203 u_int32_t nd_ra_retransmit; /* retransmit timer */ 204 /* could be followed by options */ 205 } __packed; 206 207 #define nd_ra_type nd_ra_hdr.icmp6_type 208 #define nd_ra_code nd_ra_hdr.icmp6_code 209 #define nd_ra_cksum nd_ra_hdr.icmp6_cksum 210 #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] 211 #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] 212 #define ND_RA_FLAG_MANAGED 0x80 213 #define ND_RA_FLAG_OTHER 0x40 214 #define ND_RA_FLAG_HOME_AGENT 0x20 215 216 /* 217 * Router preference values based on RFC4191. 218 */ 219 #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ 220 221 #define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ 222 #define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ 223 #define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ 224 #define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ 225 226 #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] 227 228 struct nd_neighbor_solicit { /* neighbor solicitation */ 229 struct icmp6_hdr nd_ns_hdr; 230 struct in6_addr nd_ns_target; /*target address */ 231 /* could be followed by options */ 232 } __packed; 233 234 #define nd_ns_type nd_ns_hdr.icmp6_type 235 #define nd_ns_code nd_ns_hdr.icmp6_code 236 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum 237 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] 238 239 struct nd_neighbor_advert { /* neighbor advertisement */ 240 struct icmp6_hdr nd_na_hdr; 241 struct in6_addr nd_na_target; /* target address */ 242 /* could be followed by options */ 243 } __packed; 244 245 #define nd_na_type nd_na_hdr.icmp6_type 246 #define nd_na_code nd_na_hdr.icmp6_code 247 #define nd_na_cksum nd_na_hdr.icmp6_cksum 248 #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] 249 #define ND_NA_FLAG_ROUTER 0x80 250 #define ND_NA_FLAG_SOLICITED 0x40 251 #define ND_NA_FLAG_OVERRIDE 0x20 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 } __packed; 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 } __packed; 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_SOURCE_ADDRLIST 9 279 #define ND_OPT_TARGET_ADDRLIST 10 280 #define ND_OPT_MAP 23 /* RFC 5380 */ 281 #define ND_OPT_ROUTE_INFO 24 /* RFC 4191 */ 282 #define ND_OPT_RDNSS 25 /* RFC 6016 */ 283 #define ND_OPT_DNSSL 31 /* RFC 6016 */ 284 #define ND_OPT_CAPTIVE_PORTAL 37 /* RFC 7710 */ 285 #define ND_OPT_PREF64 38 /* RFC-ietf-6man-ra-pref64-09 */ 286 287 struct nd_opt_route_info { /* route info */ 288 u_int8_t nd_opt_rti_type; 289 u_int8_t nd_opt_rti_len; 290 u_int8_t nd_opt_rti_prefixlen; 291 u_int8_t nd_opt_rti_flags; 292 u_int32_t nd_opt_rti_lifetime; 293 /* prefix follows */ 294 }; 295 296 struct nd_opt_prefix_info { /* prefix information */ 297 u_int8_t nd_opt_pi_type; 298 u_int8_t nd_opt_pi_len; 299 u_int8_t nd_opt_pi_prefix_len; 300 u_int8_t nd_opt_pi_flags_reserved; 301 u_int32_t nd_opt_pi_valid_time; 302 u_int32_t nd_opt_pi_preferred_time; 303 u_int32_t nd_opt_pi_reserved2; 304 struct in6_addr nd_opt_pi_prefix; 305 } __packed; 306 307 #define ND_OPT_PI_FLAG_ONLINK 0x80 308 #define ND_OPT_PI_FLAG_AUTO 0x40 309 310 struct nd_opt_rd_hdr { /* redirected header */ 311 u_int8_t nd_opt_rh_type; 312 u_int8_t nd_opt_rh_len; 313 u_int16_t nd_opt_rh_reserved1; 314 u_int32_t nd_opt_rh_reserved2; 315 /* followed by IP header and data */ 316 } __packed; 317 318 struct nd_opt_mtu { /* MTU option */ 319 u_int8_t nd_opt_mtu_type; 320 u_int8_t nd_opt_mtu_len; 321 u_int16_t nd_opt_mtu_reserved; 322 u_int32_t nd_opt_mtu_mtu; 323 } __packed; 324 325 struct nd_opt_rdnss { /* RDNSS option RFC 6106 */ 326 u_int8_t nd_opt_rdnss_type; 327 u_int8_t nd_opt_rdnss_len; 328 u_int16_t nd_opt_rdnss_reserved; 329 u_int32_t nd_opt_rdnss_lifetime; 330 /* followed by list of IP prefixes */ 331 } __packed; 332 333 struct nd_opt_dnssl { /* DNSSL option RFC 6106 */ 334 u_int8_t nd_opt_dnssl_type; 335 u_int8_t nd_opt_dnssl_len; 336 u_int16_t nd_opt_dnssl_reserved; 337 u_int32_t nd_opt_dnssl_lifetime; 338 /* followed by list of IP prefixes */ 339 } __packed; 340 341 struct nd_opt_captive_portal { /* CAPTIVE PORTAL option RFC 7710 */ 342 u_int8_t nd_opt_captive_portal_type; // ND_OPT_CAPTIVE_PORTAL 343 u_int8_t nd_opt_captive_portal_len; // in 8 byte units 344 u_int8_t nd_opt_captive_portal_uri[]; // 6 + n*8 bytes 345 } __packed; 346 347 struct nd_opt_pref64 { /* PREF64 option RFC-ietf-6man-ra-pref64-09 */ 348 u_int8_t nd_opt_pref64_type; // ND_OPT_PREF64 349 u_int8_t nd_opt_pref64_len; // 8 byte units, thus '2' 350 u_int16_t nd_opt_pref64_lifetime_plc; // net endian, 13 + 3 bits 351 u_int8_t nd_opt_pref64_prefix[12]; // top 96 bits 352 } __packed; 353 354 /* 355 * icmp6 namelookup 356 */ 357 358 struct icmp6_namelookup { 359 struct icmp6_hdr icmp6_nl_hdr; 360 u_int8_t icmp6_nl_nonce[8]; 361 int32_t icmp6_nl_ttl; 362 #if 0 363 u_int8_t icmp6_nl_len; 364 u_int8_t icmp6_nl_name[3]; 365 #endif 366 /* could be followed by options */ 367 } __packed; 368 369 /* 370 * icmp6 node information 371 */ 372 struct icmp6_nodeinfo { 373 struct icmp6_hdr icmp6_ni_hdr; 374 u_int8_t icmp6_ni_nonce[8]; 375 /* could be followed by reply data */ 376 } __packed; 377 378 /* 379 * BEGIN android-removed: glibc doesn't have these, and external/ping declares them itself. 380 #define ni_type icmp6_ni_hdr.icmp6_type 381 #define ni_code icmp6_ni_hdr.icmp6_code 382 #define ni_cksum icmp6_ni_hdr.icmp6_cksum 383 #define ni_qtype icmp6_ni_hdr.icmp6_data16[0] 384 #define ni_flags icmp6_ni_hdr.icmp6_data16[1] 385 * END android-removed 386 */ 387 388 #define NI_QTYPE_NOOP 0 /* NOOP */ 389 #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ 390 #define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ 391 #define NI_QTYPE_DNSNAME 2 /* DNS Name */ 392 #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ 393 #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ 394 395 #define NI_SUPTYPE_FLAG_COMPRESS 0x0100 396 #define NI_FQDN_FLAG_VALIDTTL 0x0100 397 398 #ifdef NAME_LOOKUPS_04 399 #define NI_NODEADDR_FLAG_LINKLOCAL 0x0100 400 #define NI_NODEADDR_FLAG_SITELOCAL 0x0200 401 #define NI_NODEADDR_FLAG_GLOBAL 0x0400 402 #define NI_NODEADDR_FLAG_ALL 0x0800 403 #define NI_NODEADDR_FLAG_TRUNCATE 0x1000 404 #define NI_NODEADDR_FLAG_ANYCAST 0x2000 /* just experimental. not in spec */ 405 #else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */ 406 #define NI_NODEADDR_FLAG_TRUNCATE 0x0100 407 #define NI_NODEADDR_FLAG_ALL 0x0200 408 #define NI_NODEADDR_FLAG_COMPAT 0x0400 409 #define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 410 #define NI_NODEADDR_FLAG_SITELOCAL 0x1000 411 #define NI_NODEADDR_FLAG_GLOBAL 0x2000 412 #define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ 413 #endif 414 415 struct ni_reply_fqdn { 416 u_int32_t ni_fqdn_ttl; /* TTL */ 417 u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ 418 u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ 419 } __packed; 420 421 /* 422 * Router Renumbering. as router-renum-08.txt 423 */ 424 struct icmp6_router_renum { /* router renumbering header */ 425 struct icmp6_hdr rr_hdr; 426 u_int8_t rr_segnum; 427 u_int8_t rr_flags; 428 u_int16_t rr_maxdelay; 429 u_int32_t rr_reserved; 430 } __packed; 431 432 #define ICMP6_RR_FLAGS_TEST 0x80 433 #define ICMP6_RR_FLAGS_REQRESULT 0x40 434 #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 435 #define ICMP6_RR_FLAGS_SPECSITE 0x10 436 #define ICMP6_RR_FLAGS_PREVDONE 0x08 437 438 #define rr_type rr_hdr.icmp6_type 439 #define rr_code rr_hdr.icmp6_code 440 #define rr_cksum rr_hdr.icmp6_cksum 441 #define rr_seqnum rr_hdr.icmp6_data32[0] 442 443 struct rr_pco_match { /* match prefix part */ 444 u_int8_t rpm_code; 445 u_int8_t rpm_len; 446 u_int8_t rpm_ordinal; 447 u_int8_t rpm_matchlen; 448 u_int8_t rpm_minlen; 449 u_int8_t rpm_maxlen; 450 u_int16_t rpm_reserved; 451 struct in6_addr rpm_prefix; 452 } __packed; 453 454 #define RPM_PCO_ADD 1 455 #define RPM_PCO_CHANGE 2 456 #define RPM_PCO_SETGLOBAL 3 457 #define RPM_PCO_MAX 4 458 459 struct rr_pco_use { /* use prefix part */ 460 u_int8_t rpu_uselen; 461 u_int8_t rpu_keeplen; 462 u_int8_t rpu_ramask; 463 u_int8_t rpu_raflags; 464 u_int32_t rpu_vltime; 465 u_int32_t rpu_pltime; 466 u_int32_t rpu_flags; 467 struct in6_addr rpu_prefix; 468 } __packed; 469 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 470 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 471 472 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 473 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 474 475 struct rr_result { /* router renumbering result message */ 476 u_int16_t rrr_flags; 477 u_int8_t rrr_ordinal; 478 u_int8_t rrr_matchedlen; 479 u_int32_t rrr_ifid; 480 struct in6_addr rrr_prefix; 481 } __packed; 482 #define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 483 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 484 485 /* 486 * icmp6 filter structures. 487 */ 488 489 struct icmp6_filter { 490 u_int32_t icmp6_filt[8]; 491 }; 492 493 /* 494 * BEGIN android-changed 495 * Linux and *BSD kernels use opposite values to indicate pass/block in ICMPv6 496 * filters, and assign a different value to the ICMP6_FILTER sockopt. 497 */ 498 #define ICMP6_FILTER 1 499 500 #define ICMP6_FILTER_SETPASSALL(filterp) \ 501 (void)memset(filterp, 0x00, sizeof(struct icmp6_filter)) 502 #define ICMP6_FILTER_SETBLOCKALL(filterp) \ 503 (void)memset(filterp, 0xff, sizeof(struct icmp6_filter)) 504 #define ICMP6_FILTER_SETPASS(type, filterp) \ 505 (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) 506 #define ICMP6_FILTER_SETBLOCK(type, filterp) \ 507 (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) 508 #define ICMP6_FILTER_WILLPASS(type, filterp) \ 509 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) 510 #define ICMP6_FILTER_WILLBLOCK(type, filterp) \ 511 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) 512 /* 513 * END android-changed 514 */ 515 516 #endif /* !_NETINET_ICMP6_H_ */ 517