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 <netinet/in.h> /* android-added: glibc source compatibility. */ 69 #include <sys/cdefs.h> 70 71 #define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) 72 - sizeof(struct icmp6_hdr) */ 73 74 struct icmp6_hdr { 75 u_int8_t icmp6_type; /* type field */ 76 u_int8_t icmp6_code; /* code field */ 77 u_int16_t icmp6_cksum; /* checksum field */ 78 union { 79 u_int32_t icmp6_un_data32[1]; /* type-specific field */ 80 u_int16_t icmp6_un_data16[2]; /* type-specific field */ 81 u_int8_t icmp6_un_data8[4]; /* type-specific field */ 82 } icmp6_dataun; 83 } __packed; 84 85 #define icmp6_data32 icmp6_dataun.icmp6_un_data32 86 #define icmp6_data16 icmp6_dataun.icmp6_un_data16 87 #define icmp6_data8 icmp6_dataun.icmp6_un_data8 88 #define icmp6_pptr icmp6_data32[0] /* parameter prob */ 89 #define icmp6_mtu icmp6_data32[0] /* packet too big */ 90 #define icmp6_id icmp6_data16[0] /* echo request/reply */ 91 #define icmp6_seq icmp6_data16[1] /* echo request/reply */ 92 #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ 93 94 #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ 95 #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ 96 #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ 97 #define ICMP6_PARAM_PROB 4 /* ip6 header bad */ 98 99 #define ICMP6_ECHO_REQUEST 128 /* echo service */ 100 #define ICMP6_ECHO_REPLY 129 /* echo reply */ 101 #define MLD_LISTENER_QUERY 130 /* multicast listener query */ 102 #define MLD_LISTENER_REPORT 131 /* multicast listener report */ 103 #define MLD_LISTENER_DONE 132 /* multicast listener done */ 104 #define MLD_LISTENER_REDUCTION MLD_LISTENER_DONE /* RFC3542 definition */ 105 106 /* RFC2292 decls */ 107 #define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ 108 #define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ 109 #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ 110 111 #define ND_ROUTER_SOLICIT 133 /* router solicitation */ 112 #define ND_ROUTER_ADVERT 134 /* router advertisement */ 113 #define ND_NEIGHBOR_SOLICIT 135 /* neighbor solicitation */ 114 #define ND_NEIGHBOR_ADVERT 136 /* neighbor advertisement */ 115 #define ND_REDIRECT 137 /* redirect */ 116 117 #define ICMP6_ROUTER_RENUMBERING 138 /* router renumbering */ 118 119 #define ICMP6_WRUREQUEST 139 /* who are you request */ 120 #define ICMP6_WRUREPLY 140 /* who are you reply */ 121 #define ICMP6_FQDN_QUERY 139 /* FQDN query */ 122 #define ICMP6_FQDN_REPLY 140 /* FQDN reply */ 123 #define ICMP6_NI_QUERY 139 /* node information request */ 124 #define ICMP6_NI_REPLY 140 /* node information reply */ 125 #define MLDV2_LISTENER_REPORT 143 /* RFC3810 listener report */ 126 127 /* The definitions below are experimental. TBA */ 128 #define MLD_MTRACE_RESP 200 /* mtrace response(to sender) */ 129 #define MLD_MTRACE 201 /* mtrace messages */ 130 131 #define ICMP6_MAXTYPE 201 132 133 #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ 134 #define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ 135 #define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ 136 #define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ 137 #define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ 138 #define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ 139 #define ICMP6_DST_UNREACH_POLICY 5 /* source address failed ingress/egress policy */ 140 #define ICMP6_DST_UNREACH_REJROUTE 6 /* reject route to destination */ 141 #define ICMP6_DST_UNREACH_SOURCERT 7 /* error in source routing header */ 142 143 #define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ 144 #define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ 145 146 #define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ 147 #define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ 148 #define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ 149 150 #define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ 151 152 #define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ 153 #define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ 154 #define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ 155 156 #define ICMP6_NI_SUCCESS 0 /* node information successful reply */ 157 #define ICMP6_NI_REFUSED 1 /* node information request is refused */ 158 #define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ 159 160 #define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ 161 #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ 162 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ 163 164 /* Used in kernel only */ 165 #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ 166 #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ 167 168 /* 169 * Multicast Listener Discovery 170 */ 171 struct mld_hdr { 172 struct icmp6_hdr mld_icmp6_hdr; 173 struct in6_addr mld_addr; /* multicast address */ 174 } __packed; 175 176 /* shortcut macro definitions */ 177 #define mld_type mld_icmp6_hdr.icmp6_type 178 #define mld_code mld_icmp6_hdr.icmp6_code 179 #define mld_cksum mld_icmp6_hdr.icmp6_cksum 180 #define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] 181 #define mld_reserved mld_icmp6_hdr.icmp6_data16[1] 182 183 #define MLD_MINLEN 24 184 185 /* 186 * Neighbor Discovery 187 */ 188 189 struct nd_router_solicit { /* router solicitation */ 190 struct icmp6_hdr nd_rs_hdr; 191 /* could be followed by options */ 192 } __packed; 193 194 #define nd_rs_type nd_rs_hdr.icmp6_type 195 #define nd_rs_code nd_rs_hdr.icmp6_code 196 #define nd_rs_cksum nd_rs_hdr.icmp6_cksum 197 #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] 198 199 struct nd_router_advert { /* router advertisement */ 200 struct icmp6_hdr nd_ra_hdr; 201 u_int32_t nd_ra_reachable; /* reachable time */ 202 u_int32_t nd_ra_retransmit; /* retransmit timer */ 203 /* could be followed by options */ 204 } __packed; 205 206 #define nd_ra_type nd_ra_hdr.icmp6_type 207 #define nd_ra_code nd_ra_hdr.icmp6_code 208 #define nd_ra_cksum nd_ra_hdr.icmp6_cksum 209 #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] 210 #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] 211 #define ND_RA_FLAG_MANAGED 0x80 212 #define ND_RA_FLAG_OTHER 0x40 213 #define ND_RA_FLAG_HOME_AGENT 0x20 214 215 /* 216 * Router preference values based on RFC4191. 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 } __packed; 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 } __packed; 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 #define ND_NA_FLAG_ROUTER 0x80 249 #define ND_NA_FLAG_SOLICITED 0x40 250 #define ND_NA_FLAG_OVERRIDE 0x20 251 252 struct nd_redirect { /* redirect */ 253 struct icmp6_hdr nd_rd_hdr; 254 struct in6_addr nd_rd_target; /* target address */ 255 struct in6_addr nd_rd_dst; /* destination address */ 256 /* could be followed by options */ 257 } __packed; 258 259 #define nd_rd_type nd_rd_hdr.icmp6_type 260 #define nd_rd_code nd_rd_hdr.icmp6_code 261 #define nd_rd_cksum nd_rd_hdr.icmp6_cksum 262 #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] 263 264 struct nd_opt_hdr { /* Neighbor discovery option header */ 265 u_int8_t nd_opt_type; 266 u_int8_t nd_opt_len; 267 /* followed by option specific data*/ 268 } __packed; 269 270 #define ND_OPT_SOURCE_LINKADDR 1 271 #define ND_OPT_TARGET_LINKADDR 2 272 #define ND_OPT_PREFIX_INFORMATION 3 273 #define ND_OPT_REDIRECTED_HEADER 4 274 #define ND_OPT_MTU 5 275 #define ND_OPT_ADVINTERVAL 7 276 #define ND_OPT_HOMEAGENT_INFO 8 277 #define ND_OPT_SOURCE_ADDRLIST 9 278 #define ND_OPT_TARGET_ADDRLIST 10 279 #define ND_OPT_MAP 23 /* RFC 5380 */ 280 #define ND_OPT_ROUTE_INFO 24 /* RFC 4191 */ 281 #define ND_OPT_RDNSS 25 /* RFC 6016 */ 282 #define ND_OPT_DNSSL 31 /* RFC 6016 */ 283 #define ND_OPT_CAPTIVE_PORTAL 37 /* RFC 7710 */ 284 #define ND_OPT_PREF64 38 /* RFC-ietf-6man-ra-pref64-09 */ 285 286 struct nd_opt_route_info { /* route info */ 287 u_int8_t nd_opt_rti_type; 288 u_int8_t nd_opt_rti_len; 289 u_int8_t nd_opt_rti_prefixlen; 290 u_int8_t nd_opt_rti_flags; 291 u_int32_t nd_opt_rti_lifetime; 292 /* prefix follows */ 293 }; 294 295 struct nd_opt_prefix_info { /* prefix information */ 296 u_int8_t nd_opt_pi_type; 297 u_int8_t nd_opt_pi_len; 298 u_int8_t nd_opt_pi_prefix_len; 299 u_int8_t nd_opt_pi_flags_reserved; 300 u_int32_t nd_opt_pi_valid_time; 301 u_int32_t nd_opt_pi_preferred_time; 302 u_int32_t nd_opt_pi_reserved2; 303 struct in6_addr nd_opt_pi_prefix; 304 } __packed; 305 306 #define ND_OPT_PI_FLAG_ONLINK 0x80 307 #define ND_OPT_PI_FLAG_AUTO 0x40 308 309 struct nd_opt_rd_hdr { /* redirected header */ 310 u_int8_t nd_opt_rh_type; 311 u_int8_t nd_opt_rh_len; 312 u_int16_t nd_opt_rh_reserved1; 313 u_int32_t nd_opt_rh_reserved2; 314 /* followed by IP header and data */ 315 } __packed; 316 317 struct nd_opt_mtu { /* MTU option */ 318 u_int8_t nd_opt_mtu_type; 319 u_int8_t nd_opt_mtu_len; 320 u_int16_t nd_opt_mtu_reserved; 321 u_int32_t nd_opt_mtu_mtu; 322 } __packed; 323 324 struct nd_opt_rdnss { /* RDNSS option RFC 6106 */ 325 u_int8_t nd_opt_rdnss_type; 326 u_int8_t nd_opt_rdnss_len; 327 u_int16_t nd_opt_rdnss_reserved; 328 u_int32_t nd_opt_rdnss_lifetime; 329 /* followed by list of IP prefixes */ 330 } __packed; 331 332 struct nd_opt_dnssl { /* DNSSL option RFC 6106 */ 333 u_int8_t nd_opt_dnssl_type; 334 u_int8_t nd_opt_dnssl_len; 335 u_int16_t nd_opt_dnssl_reserved; 336 u_int32_t nd_opt_dnssl_lifetime; 337 /* followed by list of IP prefixes */ 338 } __packed; 339 340 struct nd_opt_captive_portal { /* CAPTIVE PORTAL option RFC 7710 */ 341 u_int8_t nd_opt_captive_portal_type; // ND_OPT_CAPTIVE_PORTAL 342 u_int8_t nd_opt_captive_portal_len; // in 8 byte units 343 u_int8_t nd_opt_captive_portal_uri[]; // 6 + n*8 bytes 344 } __packed; 345 346 struct nd_opt_pref64 { /* PREF64 option RFC-ietf-6man-ra-pref64-09 */ 347 u_int8_t nd_opt_pref64_type; // ND_OPT_PREF64 348 u_int8_t nd_opt_pref64_len; // 8 byte units, thus '2' 349 u_int16_t nd_opt_pref64_lifetime_plc; // net endian, 13 + 3 bits 350 u_int8_t nd_opt_pref64_prefix[12]; // top 96 bits 351 } __packed; 352 353 /* 354 * icmp6 namelookup 355 */ 356 357 struct icmp6_namelookup { 358 struct icmp6_hdr icmp6_nl_hdr; 359 u_int8_t icmp6_nl_nonce[8]; 360 int32_t icmp6_nl_ttl; 361 #if 0 362 u_int8_t icmp6_nl_len; 363 u_int8_t icmp6_nl_name[3]; 364 #endif 365 /* could be followed by options */ 366 } __packed; 367 368 /* 369 * icmp6 node information 370 */ 371 struct icmp6_nodeinfo { 372 struct icmp6_hdr icmp6_ni_hdr; 373 u_int8_t icmp6_ni_nonce[8]; 374 /* could be followed by reply data */ 375 } __packed; 376 377 /* 378 * BEGIN android-removed: glibc doesn't have these, and external/ping declares them itself. 379 #define ni_type icmp6_ni_hdr.icmp6_type 380 #define ni_code icmp6_ni_hdr.icmp6_code 381 #define ni_cksum icmp6_ni_hdr.icmp6_cksum 382 #define ni_qtype icmp6_ni_hdr.icmp6_data16[0] 383 #define ni_flags icmp6_ni_hdr.icmp6_data16[1] 384 * END android-removed 385 */ 386 387 #define NI_QTYPE_NOOP 0 /* NOOP */ 388 #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ 389 #define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ 390 #define NI_QTYPE_DNSNAME 2 /* DNS Name */ 391 #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ 392 #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ 393 394 #define NI_SUPTYPE_FLAG_COMPRESS 0x0100 395 #define NI_FQDN_FLAG_VALIDTTL 0x0100 396 397 #ifdef NAME_LOOKUPS_04 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 #else /* draft-ietf-ipngwg-icmp-name-lookups-05 (and later?) */ 405 #define NI_NODEADDR_FLAG_TRUNCATE 0x0100 406 #define NI_NODEADDR_FLAG_ALL 0x0200 407 #define NI_NODEADDR_FLAG_COMPAT 0x0400 408 #define NI_NODEADDR_FLAG_LINKLOCAL 0x0800 409 #define NI_NODEADDR_FLAG_SITELOCAL 0x1000 410 #define NI_NODEADDR_FLAG_GLOBAL 0x2000 411 #define NI_NODEADDR_FLAG_ANYCAST 0x4000 /* just experimental. not in spec */ 412 #endif 413 414 struct ni_reply_fqdn { 415 u_int32_t ni_fqdn_ttl; /* TTL */ 416 u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ 417 u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ 418 } __packed; 419 420 /* 421 * Router Renumbering. as router-renum-08.txt 422 */ 423 struct icmp6_router_renum { /* router renumbering header */ 424 struct icmp6_hdr rr_hdr; 425 u_int8_t rr_segnum; 426 u_int8_t rr_flags; 427 u_int16_t rr_maxdelay; 428 u_int32_t rr_reserved; 429 } __packed; 430 431 #define ICMP6_RR_FLAGS_TEST 0x80 432 #define ICMP6_RR_FLAGS_REQRESULT 0x40 433 #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 434 #define ICMP6_RR_FLAGS_SPECSITE 0x10 435 #define ICMP6_RR_FLAGS_PREVDONE 0x08 436 437 #define rr_type rr_hdr.icmp6_type 438 #define rr_code rr_hdr.icmp6_code 439 #define rr_cksum rr_hdr.icmp6_cksum 440 #define rr_seqnum rr_hdr.icmp6_data32[0] 441 442 struct rr_pco_match { /* match prefix part */ 443 u_int8_t rpm_code; 444 u_int8_t rpm_len; 445 u_int8_t rpm_ordinal; 446 u_int8_t rpm_matchlen; 447 u_int8_t rpm_minlen; 448 u_int8_t rpm_maxlen; 449 u_int16_t rpm_reserved; 450 struct in6_addr rpm_prefix; 451 } __packed; 452 453 #define RPM_PCO_ADD 1 454 #define RPM_PCO_CHANGE 2 455 #define RPM_PCO_SETGLOBAL 3 456 #define RPM_PCO_MAX 4 457 458 struct rr_pco_use { /* use prefix part */ 459 u_int8_t rpu_uselen; 460 u_int8_t rpu_keeplen; 461 u_int8_t rpu_ramask; 462 u_int8_t rpu_raflags; 463 u_int32_t rpu_vltime; 464 u_int32_t rpu_pltime; 465 u_int32_t rpu_flags; 466 struct in6_addr rpu_prefix; 467 } __packed; 468 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 469 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 470 471 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME 0x80 472 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME 0x40 473 474 struct rr_result { /* router renumbering result message */ 475 u_int16_t rrr_flags; 476 u_int8_t rrr_ordinal; 477 u_int8_t rrr_matchedlen; 478 u_int32_t rrr_ifid; 479 struct in6_addr rrr_prefix; 480 } __packed; 481 #define ICMP6_RR_RESULT_FLAGS_OOB 0x0200 482 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN 0x0100 483 484 /* 485 * icmp6 filter structures. 486 */ 487 488 struct icmp6_filter { 489 u_int32_t icmp6_filt[8]; 490 }; 491 492 /* 493 * BEGIN android-changed 494 * Linux and *BSD kernels use opposite values to indicate pass/block in ICMPv6 495 * filters, and assign a different value to the ICMP6_FILTER sockopt. 496 */ 497 #define ICMP6_FILTER 1 498 499 #define ICMP6_FILTER_SETPASSALL(filterp) \ 500 (void)memset(filterp, 0x00, sizeof(struct icmp6_filter)) 501 #define ICMP6_FILTER_SETBLOCKALL(filterp) \ 502 (void)memset(filterp, 0xff, sizeof(struct icmp6_filter)) 503 #define ICMP6_FILTER_SETPASS(type, filterp) \ 504 (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) 505 #define ICMP6_FILTER_SETBLOCK(type, filterp) \ 506 (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) 507 #define ICMP6_FILTER_WILLPASS(type, filterp) \ 508 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) 509 #define ICMP6_FILTER_WILLBLOCK(type, filterp) \ 510 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) 511 /* 512 * END android-changed 513 */ 514 515 #endif /* !_NETINET_ICMP6_H_ */ 516