1 /* $OpenBSD: icmp6.h,v 1.42 2015/09/09 15:51:40 mpi Exp $ */ 2 /* $KAME: icmp6.h,v 1.84 2003/04/23 10:26:51 itojun Exp $ */ 3 4 /* 5 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 6 * All rights reserved. 7 * 8 * Redistribution and use in source and binary forms, with or without 9 * modification, are permitted provided that the following conditions 10 * are met: 11 * 1. Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 2. Redistributions in binary form must reproduce the above copyright 14 * notice, this list of conditions and the following disclaimer in the 15 * documentation and/or other materials provided with the distribution. 16 * 3. Neither the name of the project nor the names of its contributors 17 * may be used to endorse or promote products derived from this software 18 * without specific prior written permission. 19 * 20 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 21 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 23 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 24 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 26 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 27 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 29 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 30 * SUCH DAMAGE. 31 */ 32 33 /* 34 * Copyright (c) 1982, 1986, 1993 35 * The Regents of the University of California. All rights reserved. 36 * 37 * Redistribution and use in source and binary forms, with or without 38 * modification, are permitted provided that the following conditions 39 * are met: 40 * 1. Redistributions of source code must retain the above copyright 41 * notice, this list of conditions and the following disclaimer. 42 * 2. Redistributions in binary form must reproduce the above copyright 43 * notice, this list of conditions and the following disclaimer in the 44 * documentation and/or other materials provided with the distribution. 45 * 3. Neither the name of the University nor the names of its contributors 46 * may be used to endorse or promote products derived from this software 47 * without specific prior written permission. 48 * 49 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 50 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 51 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 52 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 53 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 54 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 55 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 56 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 57 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 58 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 59 * SUCH DAMAGE. 60 * 61 * @(#)ip_icmp.h 8.1 (Berkeley) 6/10/93 62 */ 63 64 #ifndef _NETINET_ICMP6_H_ 65 #define _NETINET_ICMP6_H_ 66 67 #define ICMPV6_PLD_MAXLEN 1232 /* IPV6_MMTU - sizeof(struct ip6_hdr) 68 - sizeof(struct icmp6_hdr) */ 69 70 struct icmp6_hdr { 71 u_int8_t icmp6_type; /* type field */ 72 u_int8_t icmp6_code; /* code field */ 73 u_int16_t icmp6_cksum; /* checksum field */ 74 union { 75 u_int32_t icmp6_un_data32[1]; /* type-specific field */ 76 u_int16_t icmp6_un_data16[2]; /* type-specific field */ 77 u_int8_t icmp6_un_data8[4]; /* type-specific field */ 78 } icmp6_dataun; 79 } __packed; 80 81 #define icmp6_data32 icmp6_dataun.icmp6_un_data32 82 #define icmp6_data16 icmp6_dataun.icmp6_un_data16 83 #define icmp6_data8 icmp6_dataun.icmp6_un_data8 84 #define icmp6_pptr icmp6_data32[0] /* parameter prob */ 85 #define icmp6_mtu icmp6_data32[0] /* packet too big */ 86 #define icmp6_id icmp6_data16[0] /* echo request/reply */ 87 #define icmp6_seq icmp6_data16[1] /* echo request/reply */ 88 #define icmp6_maxdelay icmp6_data16[0] /* mcast group membership */ 89 90 #define ICMP6_DST_UNREACH 1 /* dest unreachable, codes: */ 91 #define ICMP6_PACKET_TOO_BIG 2 /* packet too big */ 92 #define ICMP6_TIME_EXCEEDED 3 /* time exceeded, code: */ 93 #define ICMP6_PARAM_PROB 4 /* ip6 header bad */ 94 95 #define ICMP6_ECHO_REQUEST 128 /* echo service */ 96 #define ICMP6_ECHO_REPLY 129 /* echo reply */ 97 #define MLD_LISTENER_QUERY 130 /* multicast listener query */ 98 #define MLD_LISTENER_REPORT 131 /* multicast listener report */ 99 #define MLD_LISTENER_DONE 132 /* multicast listener done */ 100 101 /* RFC2292 decls */ 102 #define ICMP6_MEMBERSHIP_QUERY 130 /* group membership query */ 103 #define ICMP6_MEMBERSHIP_REPORT 131 /* group membership report */ 104 #define ICMP6_MEMBERSHIP_REDUCTION 132 /* group membership termination */ 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 MLDV2_LISTENER_REPORT 143 /* RFC3810 listener report */ 121 122 /* The definitions below are experimental. TBA */ 123 #define MLD_MTRACE_RESP 200 /* mtrace response(to sender) */ 124 #define MLD_MTRACE 201 /* mtrace messages */ 125 126 #define ICMP6_MAXTYPE 201 127 128 #define ICMP6_DST_UNREACH_NOROUTE 0 /* no route to destination */ 129 #define ICMP6_DST_UNREACH_ADMIN 1 /* administratively prohibited */ 130 #define ICMP6_DST_UNREACH_NOTNEIGHBOR 2 /* not a neighbor(obsolete) */ 131 #define ICMP6_DST_UNREACH_BEYONDSCOPE 2 /* beyond scope of source address */ 132 #define ICMP6_DST_UNREACH_ADDR 3 /* address unreachable */ 133 #define ICMP6_DST_UNREACH_NOPORT 4 /* port unreachable */ 134 135 #define ICMP6_TIME_EXCEED_TRANSIT 0 /* ttl==0 in transit */ 136 #define ICMP6_TIME_EXCEED_REASSEMBLY 1 /* ttl==0 in reass */ 137 138 #define ICMP6_PARAMPROB_HEADER 0 /* erroneous header field */ 139 #define ICMP6_PARAMPROB_NEXTHEADER 1 /* unrecognized next header */ 140 #define ICMP6_PARAMPROB_OPTION 2 /* unrecognized option */ 141 142 #define ICMP6_INFOMSG_MASK 0x80 /* all informational messages */ 143 144 #define ICMP6_NI_SUBJ_IPV6 0 /* Query Subject is an IPv6 address */ 145 #define ICMP6_NI_SUBJ_FQDN 1 /* Query Subject is a Domain name */ 146 #define ICMP6_NI_SUBJ_IPV4 2 /* Query Subject is an IPv4 address */ 147 148 #define ICMP6_NI_SUCCESS 0 /* node information successful reply */ 149 #define ICMP6_NI_REFUSED 1 /* node information request is refused */ 150 #define ICMP6_NI_UNKNOWN 2 /* unknown Qtype */ 151 152 #define ICMP6_ROUTER_RENUMBERING_COMMAND 0 /* rr command */ 153 #define ICMP6_ROUTER_RENUMBERING_RESULT 1 /* rr result */ 154 #define ICMP6_ROUTER_RENUMBERING_SEQNUM_RESET 255 /* rr seq num reset */ 155 156 /* Used in kernel only */ 157 #define ND_REDIRECT_ONLINK 0 /* redirect to an on-link node */ 158 #define ND_REDIRECT_ROUTER 1 /* redirect to a better router */ 159 160 /* 161 * Multicast Listener Discovery 162 */ 163 struct mld_hdr { 164 struct icmp6_hdr mld_icmp6_hdr; 165 struct in6_addr mld_addr; /* multicast address */ 166 } __packed; 167 168 /* shortcut macro definitions */ 169 #define mld_type mld_icmp6_hdr.icmp6_type 170 #define mld_code mld_icmp6_hdr.icmp6_code 171 #define mld_cksum mld_icmp6_hdr.icmp6_cksum 172 #define mld_maxdelay mld_icmp6_hdr.icmp6_data16[0] 173 #define mld_reserved mld_icmp6_hdr.icmp6_data16[1] 174 175 /* 176 * Neighbor Discovery 177 */ 178 179 struct nd_router_solicit { /* router solicitation */ 180 struct icmp6_hdr nd_rs_hdr; 181 /* could be followed by options */ 182 } __packed; 183 184 #define nd_rs_type nd_rs_hdr.icmp6_type 185 #define nd_rs_code nd_rs_hdr.icmp6_code 186 #define nd_rs_cksum nd_rs_hdr.icmp6_cksum 187 #define nd_rs_reserved nd_rs_hdr.icmp6_data32[0] 188 189 struct nd_router_advert { /* router advertisement */ 190 struct icmp6_hdr nd_ra_hdr; 191 u_int32_t nd_ra_reachable; /* reachable time */ 192 u_int32_t nd_ra_retransmit; /* retransmit timer */ 193 /* could be followed by options */ 194 } __packed; 195 196 #define nd_ra_type nd_ra_hdr.icmp6_type 197 #define nd_ra_code nd_ra_hdr.icmp6_code 198 #define nd_ra_cksum nd_ra_hdr.icmp6_cksum 199 #define nd_ra_curhoplimit nd_ra_hdr.icmp6_data8[0] 200 #define nd_ra_flags_reserved nd_ra_hdr.icmp6_data8[1] 201 #define ND_RA_FLAG_MANAGED 0x80 202 #define ND_RA_FLAG_OTHER 0x40 203 204 #define ND_RA_FLAG_RTPREF_MASK 0x18 /* 00011000 */ 205 206 #define ND_RA_FLAG_RTPREF_HIGH 0x08 /* 00001000 */ 207 #define ND_RA_FLAG_RTPREF_MEDIUM 0x00 /* 00000000 */ 208 #define ND_RA_FLAG_RTPREF_LOW 0x18 /* 00011000 */ 209 #define ND_RA_FLAG_RTPREF_RSV 0x10 /* 00010000 */ 210 211 #define nd_ra_router_lifetime nd_ra_hdr.icmp6_data16[1] 212 213 struct nd_neighbor_solicit { /* neighbor solicitation */ 214 struct icmp6_hdr nd_ns_hdr; 215 struct in6_addr nd_ns_target; /*target address */ 216 /* could be followed by options */ 217 } __packed; 218 219 #define nd_ns_type nd_ns_hdr.icmp6_type 220 #define nd_ns_code nd_ns_hdr.icmp6_code 221 #define nd_ns_cksum nd_ns_hdr.icmp6_cksum 222 #define nd_ns_reserved nd_ns_hdr.icmp6_data32[0] 223 224 struct nd_neighbor_advert { /* neighbor advertisement */ 225 struct icmp6_hdr nd_na_hdr; 226 struct in6_addr nd_na_target; /* target address */ 227 /* could be followed by options */ 228 } __packed; 229 230 #define nd_na_type nd_na_hdr.icmp6_type 231 #define nd_na_code nd_na_hdr.icmp6_code 232 #define nd_na_cksum nd_na_hdr.icmp6_cksum 233 #define nd_na_flags_reserved nd_na_hdr.icmp6_data32[0] 234 #define ND_NA_FLAG_ROUTER htonl(0x80000000) 235 #define ND_NA_FLAG_SOLICITED htonl(0x40000000) 236 #define ND_NA_FLAG_OVERRIDE htonl(0x20000000) 237 238 struct nd_redirect { /* redirect */ 239 struct icmp6_hdr nd_rd_hdr; 240 struct in6_addr nd_rd_target; /* target address */ 241 struct in6_addr nd_rd_dst; /* destination address */ 242 /* could be followed by options */ 243 } __packed; 244 245 #define nd_rd_type nd_rd_hdr.icmp6_type 246 #define nd_rd_code nd_rd_hdr.icmp6_code 247 #define nd_rd_cksum nd_rd_hdr.icmp6_cksum 248 #define nd_rd_reserved nd_rd_hdr.icmp6_data32[0] 249 250 struct nd_opt_hdr { /* Neighbor discovery option header */ 251 u_int8_t nd_opt_type; 252 u_int8_t nd_opt_len; 253 /* followed by option specific data*/ 254 } __packed; 255 256 #define ND_OPT_SOURCE_LINKADDR 1 257 #define ND_OPT_TARGET_LINKADDR 2 258 #define ND_OPT_PREFIX_INFORMATION 3 259 #define ND_OPT_REDIRECTED_HEADER 4 260 #define ND_OPT_MTU 5 261 #define ND_OPT_ROUTE_INFO 24 262 #define ND_OPT_RDNSS 25 263 #define ND_OPT_DNSSL 31 264 265 struct nd_opt_prefix_info { /* prefix information */ 266 u_int8_t nd_opt_pi_type; 267 u_int8_t nd_opt_pi_len; 268 u_int8_t nd_opt_pi_prefix_len; 269 u_int8_t nd_opt_pi_flags_reserved; 270 u_int32_t nd_opt_pi_valid_time; 271 u_int32_t nd_opt_pi_preferred_time; 272 u_int32_t nd_opt_pi_reserved2; 273 struct in6_addr nd_opt_pi_prefix; 274 } __packed; 275 276 #define ND_OPT_PI_FLAG_ONLINK 0x80 277 #define ND_OPT_PI_FLAG_AUTO 0x40 278 279 struct nd_opt_rd_hdr { /* redirected header */ 280 u_int8_t nd_opt_rh_type; 281 u_int8_t nd_opt_rh_len; 282 u_int16_t nd_opt_rh_reserved1; 283 u_int32_t nd_opt_rh_reserved2; 284 /* followed by IP header and data */ 285 } __packed; 286 287 struct nd_opt_mtu { /* MTU option */ 288 u_int8_t nd_opt_mtu_type; 289 u_int8_t nd_opt_mtu_len; 290 u_int16_t nd_opt_mtu_reserved; 291 u_int32_t nd_opt_mtu_mtu; 292 } __packed; 293 294 struct nd_opt_route_info { /* route info */ 295 u_int8_t nd_opt_rti_type; 296 u_int8_t nd_opt_rti_len; 297 u_int8_t nd_opt_rti_prefixlen; 298 u_int8_t nd_opt_rti_flags; 299 u_int32_t nd_opt_rti_lifetime; 300 } __packed; 301 302 struct nd_opt_rdnss { /* RDNSS option */ 303 u_int8_t nd_opt_rdnss_type; 304 u_int8_t nd_opt_rdnss_len; 305 u_int16_t nd_opt_rdnss_reserved; 306 u_int32_t nd_opt_rdnss_lifetime; 307 /* followed by list of recursive DNS servers */ 308 } __packed; 309 310 struct nd_opt_dnssl { /* DNSSL option */ 311 u_int8_t nd_opt_dnssl_type; 312 u_int8_t nd_opt_dnssl_len; 313 u_int16_t nd_opt_dnssl_reserved; 314 u_int32_t nd_opt_dnssl_lifetime; 315 /* followed by list of DNS search domains */ 316 } __packed; 317 318 /* 319 * icmp6 namelookup 320 */ 321 struct icmp6_namelookup { 322 struct icmp6_hdr icmp6_nl_hdr; 323 u_int8_t icmp6_nl_nonce[8]; 324 int32_t icmp6_nl_ttl; 325 #if 0 326 u_int8_t icmp6_nl_len; 327 u_int8_t icmp6_nl_name[3]; 328 #endif 329 /* could be followed by options */ 330 } __packed; 331 332 /* 333 * icmp6 node information 334 */ 335 struct icmp6_nodeinfo { 336 struct icmp6_hdr icmp6_ni_hdr; 337 u_int8_t icmp6_ni_nonce[8]; 338 /* could be followed by reply data */ 339 } __packed; 340 341 #define ni_type icmp6_ni_hdr.icmp6_type 342 #define ni_code icmp6_ni_hdr.icmp6_code 343 #define ni_cksum icmp6_ni_hdr.icmp6_cksum 344 #define ni_qtype icmp6_ni_hdr.icmp6_data16[0] 345 #define ni_flags icmp6_ni_hdr.icmp6_data16[1] 346 347 #define NI_QTYPE_NOOP 0 /* NOOP */ 348 #define NI_QTYPE_SUPTYPES 1 /* Supported Qtypes */ 349 #define NI_QTYPE_FQDN 2 /* FQDN (draft 04) */ 350 #define NI_QTYPE_DNSNAME 2 /* DNS Name */ 351 #define NI_QTYPE_NODEADDR 3 /* Node Addresses */ 352 #define NI_QTYPE_IPV4ADDR 4 /* IPv4 Addresses */ 353 354 #define NI_SUPTYPE_FLAG_COMPRESS htons(0x0001) 355 #define NI_FQDN_FLAG_VALIDTTL htons(0x0001) 356 357 #define NI_NODEADDR_FLAG_TRUNCATE htons(0x0001) 358 #define NI_NODEADDR_FLAG_ALL htons(0x0002) 359 #define NI_NODEADDR_FLAG_COMPAT htons(0x0004) 360 #define NI_NODEADDR_FLAG_LINKLOCAL htons(0x0008) 361 #define NI_NODEADDR_FLAG_SITELOCAL htons(0x0010) 362 #define NI_NODEADDR_FLAG_GLOBAL htons(0x0020) 363 #define NI_NODEADDR_FLAG_ANYCAST htons(0x0040) /* not in spec */ 364 365 struct ni_reply_fqdn { 366 u_int32_t ni_fqdn_ttl; /* TTL */ 367 u_int8_t ni_fqdn_namelen; /* length in octets of the FQDN */ 368 u_int8_t ni_fqdn_name[3]; /* XXX: alignment */ 369 } __packed; 370 371 /* 372 * Router Renumbering. as router-renum-08.txt 373 */ 374 struct icmp6_router_renum { /* router renumbering header */ 375 struct icmp6_hdr rr_hdr; 376 u_int8_t rr_segnum; 377 u_int8_t rr_flags; 378 u_int16_t rr_maxdelay; 379 u_int32_t rr_reserved; 380 } __packed; 381 382 #define ICMP6_RR_FLAGS_TEST 0x80 383 #define ICMP6_RR_FLAGS_REQRESULT 0x40 384 #define ICMP6_RR_FLAGS_FORCEAPPLY 0x20 385 #define ICMP6_RR_FLAGS_SPECSITE 0x10 386 #define ICMP6_RR_FLAGS_PREVDONE 0x08 387 388 #define rr_type rr_hdr.icmp6_type 389 #define rr_code rr_hdr.icmp6_code 390 #define rr_cksum rr_hdr.icmp6_cksum 391 #define rr_seqnum rr_hdr.icmp6_data32[0] 392 393 struct rr_pco_match { /* match prefix part */ 394 u_int8_t rpm_code; 395 u_int8_t rpm_len; 396 u_int8_t rpm_ordinal; 397 u_int8_t rpm_matchlen; 398 u_int8_t rpm_minlen; 399 u_int8_t rpm_maxlen; 400 u_int16_t rpm_reserved; 401 struct in6_addr rpm_prefix; 402 } __packed; 403 404 #define RPM_PCO_ADD 1 405 #define RPM_PCO_CHANGE 2 406 #define RPM_PCO_SETGLOBAL 3 407 #define RPM_PCO_MAX 4 408 409 struct rr_pco_use { /* use prefix part */ 410 u_int8_t rpu_uselen; 411 u_int8_t rpu_keeplen; 412 u_int8_t rpu_ramask; 413 u_int8_t rpu_raflags; 414 u_int32_t rpu_vltime; 415 u_int32_t rpu_pltime; 416 u_int32_t rpu_flags; 417 struct in6_addr rpu_prefix; 418 } __packed; 419 #define ICMP6_RR_PCOUSE_RAFLAGS_ONLINK 0x80 420 #define ICMP6_RR_PCOUSE_RAFLAGS_AUTO 0x40 421 422 #define ICMP6_RR_PCOUSE_FLAGS_DECRVLTIME htonl(0x80000000) 423 #define ICMP6_RR_PCOUSE_FLAGS_DECRPLTIME htonl(0x40000000) 424 425 struct rr_result { /* router renumbering result message */ 426 u_int16_t rrr_flags; 427 u_int8_t rrr_ordinal; 428 u_int8_t rrr_matchedlen; 429 u_int32_t rrr_ifid; 430 struct in6_addr rrr_prefix; 431 } __packed; 432 #define ICMP6_RR_RESULT_FLAGS_OOB htons(0x0002) 433 #define ICMP6_RR_RESULT_FLAGS_FORBIDDEN htons(0x0001) 434 435 /* 436 * icmp6 filter structures. 437 */ 438 439 struct icmp6_filter { 440 u_int32_t icmp6_filt[8]; 441 }; 442 443 #define ICMP6_FILTER_SETPASSALL(filterp) \ 444 memset(filterp, 0xff, sizeof(struct icmp6_filter)) 445 #define ICMP6_FILTER_SETBLOCKALL(filterp) \ 446 memset(filterp, 0x00, sizeof(struct icmp6_filter)) 447 #define ICMP6_FILTER_SETPASS(type, filterp) \ 448 (((filterp)->icmp6_filt[(type) >> 5]) |= (1 << ((type) & 31))) 449 #define ICMP6_FILTER_SETBLOCK(type, filterp) \ 450 (((filterp)->icmp6_filt[(type) >> 5]) &= ~(1 << ((type) & 31))) 451 #define ICMP6_FILTER_WILLPASS(type, filterp) \ 452 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) != 0) 453 #define ICMP6_FILTER_WILLBLOCK(type, filterp) \ 454 ((((filterp)->icmp6_filt[(type) >> 5]) & (1 << ((type) & 31))) == 0) 455 456 /* 457 * Variables related to this implementation 458 * of the internet control message protocol version 6. 459 */ 460 struct icmp6errstat { 461 u_int64_t icp6errs_dst_unreach_noroute; 462 u_int64_t icp6errs_dst_unreach_admin; 463 u_int64_t icp6errs_dst_unreach_beyondscope; 464 u_int64_t icp6errs_dst_unreach_addr; 465 u_int64_t icp6errs_dst_unreach_noport; 466 u_int64_t icp6errs_packet_too_big; 467 u_int64_t icp6errs_time_exceed_transit; 468 u_int64_t icp6errs_time_exceed_reassembly; 469 u_int64_t icp6errs_paramprob_header; 470 u_int64_t icp6errs_paramprob_nextheader; 471 u_int64_t icp6errs_paramprob_option; 472 u_int64_t icp6errs_redirect; /* we regard redirect as an error here */ 473 u_int64_t icp6errs_unknown; 474 }; 475 476 struct icmp6stat { 477 /* statistics related to icmp6 packets generated */ 478 u_int64_t icp6s_error; /* # of calls to icmp6_error */ 479 u_int64_t icp6s_canterror; /* no error because old was icmp */ 480 u_int64_t icp6s_toofreq; /* no error because rate limitation */ 481 u_int64_t icp6s_outhist[256]; 482 /* statistics related to input message processed */ 483 u_int64_t icp6s_badcode; /* icmp6_code out of range */ 484 u_int64_t icp6s_tooshort; /* packet < sizeof(struct icmp6_hdr) */ 485 u_int64_t icp6s_checksum; /* bad checksum */ 486 u_int64_t icp6s_badlen; /* calculated bound mismatch */ 487 /* 488 * number of responses: this member is inherited from netinet code, but 489 * for netinet6 code, it is already available in icp6s_outhist[]. 490 */ 491 u_int64_t icp6s_reflect; 492 u_int64_t icp6s_inhist[256]; 493 u_int64_t icp6s_nd_toomanyopt; /* too many ND options */ 494 struct icmp6errstat icp6s_outerrhist; 495 #define icp6s_odst_unreach_noroute \ 496 icp6s_outerrhist.icp6errs_dst_unreach_noroute 497 #define icp6s_odst_unreach_admin icp6s_outerrhist.icp6errs_dst_unreach_admin 498 #define icp6s_odst_unreach_beyondscope \ 499 icp6s_outerrhist.icp6errs_dst_unreach_beyondscope 500 #define icp6s_odst_unreach_addr icp6s_outerrhist.icp6errs_dst_unreach_addr 501 #define icp6s_odst_unreach_noport icp6s_outerrhist.icp6errs_dst_unreach_noport 502 #define icp6s_opacket_too_big icp6s_outerrhist.icp6errs_packet_too_big 503 #define icp6s_otime_exceed_transit \ 504 icp6s_outerrhist.icp6errs_time_exceed_transit 505 #define icp6s_otime_exceed_reassembly \ 506 icp6s_outerrhist.icp6errs_time_exceed_reassembly 507 #define icp6s_oparamprob_header icp6s_outerrhist.icp6errs_paramprob_header 508 #define icp6s_oparamprob_nextheader \ 509 icp6s_outerrhist.icp6errs_paramprob_nextheader 510 #define icp6s_oparamprob_option icp6s_outerrhist.icp6errs_paramprob_option 511 #define icp6s_oredirect icp6s_outerrhist.icp6errs_redirect 512 #define icp6s_ounknown icp6s_outerrhist.icp6errs_unknown 513 u_int64_t icp6s_pmtuchg; /* path MTU changes */ 514 u_int64_t icp6s_nd_badopt; /* bad ND options */ 515 u_int64_t icp6s_badns; /* bad neighbor solicitation */ 516 u_int64_t icp6s_badna; /* bad neighbor advertisement */ 517 u_int64_t icp6s_badrs; /* bad router advertisement */ 518 u_int64_t icp6s_badra; /* bad router advertisement */ 519 u_int64_t icp6s_badredirect; /* bad redirect message */ 520 }; 521 522 /* 523 * Names for ICMP sysctl objects 524 */ 525 #define ICMPV6CTL_STATS 1 526 #define ICMPV6CTL_REDIRACCEPT 2 /* accept/process redirects */ 527 #define ICMPV6CTL_REDIRTIMEOUT 3 /* redirect cache time */ 528 #define ICMPV6CTL_ND6_PRUNE 6 529 #define ICMPV6CTL_ND6_DELAY 8 530 #define ICMPV6CTL_ND6_UMAXTRIES 9 531 #define ICMPV6CTL_ND6_MMAXTRIES 10 532 #define ICMPV6CTL_NODEINFO 13 533 #define ICMPV6CTL_ERRPPSLIMIT 14 /* ICMPv6 error pps limitation */ 534 #define ICMPV6CTL_ND6_MAXNUDHINT 15 535 #define ICMPV6CTL_MTUDISC_HIWAT 16 536 #define ICMPV6CTL_MTUDISC_LOWAT 17 537 #define ICMPV6CTL_ND6_DEBUG 18 538 #define ICMPV6CTL_ND6_DRLIST 19 539 #define ICMPV6CTL_ND6_PRLIST 20 540 #define ICMPV6CTL_MAXID 21 541 542 #define ICMPV6CTL_NAMES { \ 543 { 0, 0 }, \ 544 { 0, 0 }, \ 545 { 0, 0 }, \ 546 { "redirtimeout", CTLTYPE_INT }, \ 547 { 0, 0 }, \ 548 { 0, 0 }, \ 549 { "nd6_prune", CTLTYPE_INT }, \ 550 { 0, 0 }, \ 551 { "nd6_delay", CTLTYPE_INT }, \ 552 { "nd6_umaxtries", CTLTYPE_INT }, \ 553 { "nd6_mmaxtries", CTLTYPE_INT }, \ 554 { 0, 0 }, \ 555 { 0, 0 }, \ 556 { 0, 0 }, \ 557 { "errppslimit", CTLTYPE_INT }, \ 558 { "nd6_maxnudhint", CTLTYPE_INT }, \ 559 { "mtudisc_hiwat", CTLTYPE_INT }, \ 560 { "mtudisc_lowat", CTLTYPE_INT }, \ 561 { "nd6_debug", CTLTYPE_INT }, \ 562 { 0, 0 }, \ 563 { 0, 0 }, \ 564 } 565 566 #define ICMPV6CTL_VARS { \ 567 NULL, \ 568 NULL, \ 569 NULL, \ 570 &icmp6_redirtimeout, \ 571 NULL, \ 572 NULL, \ 573 &nd6_prune, \ 574 NULL, \ 575 &nd6_delay, \ 576 &nd6_umaxtries, \ 577 &nd6_mmaxtries, \ 578 NULL, \ 579 NULL, \ 580 NULL, \ 581 &icmp6errppslim, \ 582 &nd6_maxnudhint, \ 583 &icmp6_mtudisc_hiwat, \ 584 &icmp6_mtudisc_lowat, \ 585 &nd6_debug, \ 586 NULL, \ 587 NULL, \ 588 } 589 590 #define RTF_PROBEMTU RTF_PROTO1 591 592 #ifdef _KERNEL 593 594 struct rtentry; 595 struct rttimer; 596 struct in6_multi; 597 598 void icmp6_init(void); 599 void icmp6_paramerror(struct mbuf *, int); 600 void icmp6_error(struct mbuf *, int, int, int); 601 int icmp6_input(struct mbuf **, int *, int); 602 void icmp6_fasttimo(void); 603 void icmp6_reflect(struct mbuf *, size_t); 604 void icmp6_prepare(struct mbuf *); 605 void icmp6_redirect_input(struct mbuf *, int); 606 void icmp6_redirect_output(struct mbuf *, struct rtentry *); 607 int icmp6_sysctl(int *, u_int, void *, size_t *, void *, size_t); 608 609 struct ip6ctlparam; 610 void icmp6_mtudisc_update(struct ip6ctlparam *, int); 611 void icmp6_mtudisc_callback_register(void (*)(struct sockaddr_in6 *, u_int)); 612 613 extern int icmp6_redirtimeout; /* cache time for redirect routes */ 614 615 #endif /* _KERNEL */ 616 #endif /* _NETINET_ICMP6_H_ */ 617