1 /* 2 * Copyright (c) 2000-2020 Apple Inc. All rights reserved. 3 * 4 * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ 5 * 6 * This file contains Original Code and/or Modifications of Original Code 7 * as defined in and that are subject to the Apple Public Source License 8 * Version 2.0 (the 'License'). You may not use this file except in 9 * compliance with the License. The rights granted to you under the License 10 * may not be used to create, or enable the creation or redistribution of, 11 * unlawful or unlicensed copies of an Apple operating system, or to 12 * circumvent, violate, or enable the circumvention or violation of, any 13 * terms of an Apple operating system software license agreement. 14 * 15 * Please obtain a copy of the License at 16 * http://www.opensource.apple.com/apsl/ and read it before using this file. 17 * 18 * The Original Code and all software distributed under the License are 19 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER 20 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, 21 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, 22 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. 23 * Please see the License for the specific language governing rights and 24 * limitations under the License. 25 * 26 * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ 27 */ 28 /* 29 * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project. 30 * All rights reserved. 31 * 32 * Redistribution and use in source and binary forms, with or without 33 * modification, are permitted provided that the following conditions 34 * are met: 35 * 1. Redistributions of source code must retain the above copyright 36 * notice, this list of conditions and the following disclaimer. 37 * 2. Redistributions in binary form must reproduce the above copyright 38 * notice, this list of conditions and the following disclaimer in the 39 * documentation and/or other materials provided with the distribution. 40 * 3. Neither the name of the project nor the names of its contributors 41 * may be used to endorse or promote products derived from this software 42 * without specific prior written permission. 43 * 44 * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND 45 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 46 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 47 * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE 48 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 49 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 50 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 51 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 52 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 53 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 54 * SUCH DAMAGE. 55 */ 56 57 #ifndef _NETINET6_ND6_H_ 58 #define _NETINET6_ND6_H_ 59 #include <sys/appleapiopts.h> 60 #include <net/net_kev.h> 61 62 /* see net/route.h, or net/if_inarp.h */ 63 #ifndef RTF_ANNOUNCE 64 #define RTF_ANNOUNCE RTF_PROTO2 65 #endif 66 67 #include <sys/queue.h> 68 69 #ifdef BSD_KERNEL_PRIVATE 70 #include <net/flowadv.h> 71 #include <kern/locks.h> 72 #include <sys/tree.h> 73 #include <sys/eventhandler.h> 74 #include <netinet6/nd6_var.h> 75 76 struct llinfo_nd6 { 77 /* 78 * The following are protected by rnh_lock 79 */ 80 struct llinfo_nd6 *ln_next; 81 struct llinfo_nd6 *ln_prev; 82 struct rtentry *ln_rt; 83 /* 84 * The following are protected by rt_lock 85 */ 86 struct ifnet *ln_exclifp; /* excluded interface (prefix proxy) */ 87 struct mbuf *ln_hold; /* last packet until resolved/timeout */ 88 uint32_t ln_asked; /* # of queries already sent for this addr */ 89 short ln_state; /* reachability state */ 90 short ln_router; /* 2^0: ND6 router bit */ 91 u_int32_t ln_flags; /* flags; see below */ 92 u_int64_t ln_expire; /* lifetime for NDP state transition */ 93 u_int64_t ln_lastused; /* last used timestamp */ 94 struct if_llreach *ln_llreach; /* link-layer reachability record */ 95 }; 96 97 /* Values for ln_flags */ 98 #define ND6_LNF_TIMER_SKIP 0x1 /* modified by nd6_timer() */ 99 #define ND6_LNF_IN_USE 0x2 /* currently in llinfo_nd6 list */ 100 #endif /* BSD_KERNEL_PRIVATE */ 101 102 #define ND6_LLINFO_PURGE -3 103 #define ND6_LLINFO_NOSTATE -2 104 /* 105 * We don't need the WAITDELETE state any more, but we keep the definition 106 * in a comment line instead of removing it. This is necessary to avoid 107 * unintentionally reusing the value for another purpose, which might 108 * affect backward compatibility with old applications. 109 * (20000711 [email protected]) 110 */ 111 /* #define ND6_LLINFO_WAITDELETE -1 */ 112 #define ND6_LLINFO_INCOMPLETE 0 113 #define ND6_LLINFO_REACHABLE 1 114 #define ND6_LLINFO_STALE 2 115 #define ND6_LLINFO_DELAY 3 116 #define ND6_LLINFO_PROBE 4 117 118 #ifdef BSD_KERNEL_PRIVATE 119 120 #define ND6_CACHE_STATE_TRANSITION(ln, nstate) do {\ 121 if (nd6_debug >= 1) {\ 122 struct rtentry *ln_rt = ln != NULL ? (ln)->ln_rt : NULL; \ 123 nd6log(info,\ 124 "[%s:%d]: NDP cache entry changed from %s -> %s for address %s.\n",\ 125 __func__,\ 126 __LINE__,\ 127 ndcache_state2str((ln)->ln_state),\ 128 ndcache_state2str(nstate),\ 129 ln_rt != NULL ? ip6_sprintf(&SIN6(rt_key(ln_rt))->sin6_addr) : "N/A");\ 130 }\ 131 if (ln != NULL)\ 132 (ln)->ln_state = nstate;\ 133 } while(0) 134 135 #define ND6_IS_LLINFO_PROBREACH(n) ((n)->ln_state > ND6_LLINFO_INCOMPLETE) 136 #define ND6_LLINFO_PERMANENT(n) \ 137 (((n)->ln_expire == 0) && ((n)->ln_state > ND6_LLINFO_INCOMPLETE)) 138 139 #define ND6_EUI64_GBIT 0x01 140 #define ND6_EUI64_UBIT 0x02 141 142 #define ND6_EUI64_TO_IFID(in6) \ 143 do {(in6)->s6_addr[8] ^= ND6_EUI64_UBIT; } while (0) 144 145 #define ND6_EUI64_GROUP(in6) ((in6)->s6_addr[8] & ND6_EUI64_GBIT) 146 #define ND6_EUI64_INDIVIDUAL(in6) (!ND6_EUI64_GROUP(in6)) 147 #define ND6_EUI64_LOCAL(in6) ((in6)->s6_addr[8] & ND6_EUI64_UBIT) 148 #define ND6_EUI64_UNIVERSAL(in6) (!ND6_EUI64_LOCAL(in6)) 149 #define ND6_IFID_LOCAL(in6) (!ND6_EUI64_LOCAL(in6)) 150 #define ND6_IFID_UNIVERSAL(in6) (!ND6_EUI64_UNIVERSAL(in6)) 151 #endif /* BSD_KERNEL_PRIVATE */ 152 153 #if !defined(BSD_KERNEL_PRIVATE) 154 struct nd_ifinfo { 155 #else 156 /* For binary compatibility, this structure must not change */ 157 /* NOTE: nd_ifinfo is defined in nd6_var.h */ 158 struct nd_ifinfo_compat { 159 #endif /* !BSD_KERNEL_PRIVATE */ 160 u_int32_t linkmtu; /* LinkMTU */ 161 u_int32_t maxmtu; /* Upper bound of LinkMTU */ 162 u_int32_t basereachable; /* BaseReachableTime */ 163 u_int32_t reachable; /* Reachable Time */ 164 u_int32_t retrans; /* Retrans Timer */ 165 u_int32_t flags; /* Flags */ 166 int recalctm; /* BaseReacable re-calculation timer */ 167 u_int8_t chlim; /* CurHopLimit */ 168 u_int8_t receivedra; 169 /* the following 3 members are for privacy extension for addrconf */ 170 u_int8_t randomseed0[8]; /* upper 64 bits of SHA1 digest */ 171 u_int8_t randomseed1[8]; /* lower 64 bits (usually the EUI64 IFID) */ 172 u_int8_t randomid[8]; /* current random ID */ 173 }; 174 175 #define ND6_IFF_PERFORMNUD 0x1 176 #if defined(PRIVATE) 177 178 /* 179 * APPLE: not used. Interface specific router advertisements are handled with a 180 * specific ifnet flag: IFEF_ACCEPT_RTADVD 181 */ 182 #define ND6_IFF_ACCEPT_RTADV 0x2 183 184 /* APPLE: NOT USED not related to ND. */ 185 #define ND6_IFF_PREFER_SOURCE 0x4 186 187 /* IPv6 operation is disabled due to * DAD failure. (XXX: not ND-specific) */ 188 #define ND6_IFF_IFDISABLED 0x8 189 190 #define ND6_IFF_DONT_SET_IFROUTE 0x10 /* NOT USED */ 191 #endif /* PRIVATE */ 192 #define ND6_IFF_PROXY_PREFIXES 0x20 193 #define ND6_IFF_IGNORE_NA 0x40 194 #if defined(PRIVATE) 195 #define ND6_IFF_INSECURE 0x80 196 #endif 197 #define ND6_IFF_REPLICATED 0x100 /* sleep proxy registered */ 198 #define ND6_IFF_DAD 0x200 /* Perform DAD on the interface */ 199 200 extern int dad_enhanced; 201 #define ND6_DAD_ENHANCED_DEFAULT 1 202 203 struct in6_nbrinfo { 204 char ifname[IFNAMSIZ]; /* if name, e.g. "en0" */ 205 struct in6_addr addr; /* IPv6 address of the neighbor */ 206 long asked; /* # of queries already sent for this addr */ 207 int isrouter; /* if it acts as a router */ 208 int state; /* reachability state */ 209 int expire; /* lifetime for NDP state transition */ 210 }; 211 212 #if defined(BSD_KERNEL_PRIVATE) 213 struct in6_nbrinfo_32 { 214 char ifname[IFNAMSIZ]; 215 struct in6_addr addr; 216 u_int32_t asked; 217 int isrouter; 218 int state; 219 int expire; 220 }; 221 222 struct in6_nbrinfo_64 { 223 char ifname[IFNAMSIZ]; 224 struct in6_addr addr; 225 long asked; 226 int isrouter __attribute__((aligned(8))); 227 int state; 228 int expire; 229 } __attribute__((aligned(8))); 230 #endif /* BSD_KERNEL_PRIVATE */ 231 232 #define DRLSTSIZ 10 233 #define PRLSTSIZ 10 234 235 struct in6_drlist { 236 char ifname[IFNAMSIZ]; 237 struct { 238 struct in6_addr rtaddr; 239 u_char flags; 240 u_short rtlifetime; 241 u_long expire; 242 u_short if_index; 243 } defrouter[DRLSTSIZ]; 244 }; 245 246 #if defined(BSD_KERNEL_PRIVATE) 247 #define ND6_PROCESS_RTI_ENABLE 1 248 #define ND6_PROCESS_RTI_DISABLE 0 249 #define ND6_PROCESS_RTI_DEFAULT ND6_PROCESS_RTI_ENABLE 250 251 extern int nd6_process_rti; 252 253 struct in6_drlist_32 { 254 char ifname[IFNAMSIZ]; 255 struct { 256 struct in6_addr rtaddr; 257 u_char flags; 258 u_short rtlifetime; 259 u_int32_t expire; 260 u_short if_index; 261 } defrouter[DRLSTSIZ]; 262 }; 263 264 struct in6_drlist_64 { 265 char ifname[IFNAMSIZ]; 266 struct { 267 struct in6_addr rtaddr; 268 u_char flags; 269 u_short rtlifetime; 270 u_long expire __attribute__((aligned(8))); 271 u_short if_index __attribute__((aligned(8))); 272 } defrouter[DRLSTSIZ] __attribute__((aligned(8))); 273 }; 274 #endif /* BSD_KERNEL_PRIVATE */ 275 276 /* valid values for stateflags */ 277 #define NDDRF_INSTALLED 0x01 /* installed in the routing table */ 278 #define NDDRF_IFSCOPE 0x02 /* installed as a scoped route */ 279 #define NDDRF_STATIC 0x04 /* for internal use only */ 280 #define NDDRF_MAPPED 0x08 /* Default router addr is mapped to a different one for routing */ 281 #define NDDRF_INELIGIBLE 0x10 /* Default router entry is ineligible for default router selection */ 282 283 struct in6_defrouter { 284 struct sockaddr_in6 rtaddr; 285 u_char flags; 286 u_char stateflags; 287 u_short rtlifetime; 288 u_long expire; 289 u_short if_index; 290 }; 291 292 #if defined(BSD_KERNEL_PRIVATE) 293 struct in6_defrouter_32 { 294 struct sockaddr_in6 rtaddr; 295 u_char flags; 296 u_char stateflags; 297 u_short rtlifetime; 298 u_int32_t expire; 299 u_short if_index; 300 }; 301 302 struct in6_defrouter_64 { 303 struct sockaddr_in6 rtaddr; 304 u_char flags; 305 u_char stateflags; 306 u_short rtlifetime; 307 u_long expire __attribute__((aligned(8))); 308 u_short if_index __attribute__((aligned(8))); 309 } __attribute__((aligned(8))); 310 #endif /* BSD_KERNEL_PRIVATE */ 311 312 struct in6_prlist { 313 char ifname[IFNAMSIZ]; 314 struct { 315 struct in6_addr prefix; 316 struct prf_ra raflags; 317 u_char prefixlen; 318 u_char origin; 319 u_long vltime; 320 u_long pltime; 321 u_long expire; 322 u_short if_index; 323 u_short advrtrs; /* number of advertisement routers */ 324 struct in6_addr advrtr[DRLSTSIZ]; /* XXX: explicit limit */ 325 } prefix[PRLSTSIZ]; 326 }; 327 328 #if defined(BSD_KERNEL_PRIVATE) 329 struct in6_prlist_32 { 330 char ifname[IFNAMSIZ]; 331 struct { 332 struct in6_addr prefix; 333 struct prf_ra raflags; 334 u_char prefixlen; 335 u_char origin; 336 u_int32_t vltime; 337 u_int32_t pltime; 338 u_int32_t expire; 339 u_short if_index; 340 u_short advrtrs; 341 struct in6_addr advrtr[DRLSTSIZ]; 342 } prefix[PRLSTSIZ]; 343 }; 344 345 struct in6_prlist_64 { 346 char ifname[IFNAMSIZ]; 347 struct { 348 struct in6_addr prefix; 349 struct prf_ra raflags; 350 u_char prefixlen; 351 u_char origin; 352 u_long vltime __attribute__((aligned(8))); 353 u_long pltime __attribute__((aligned(8))); 354 u_long expire __attribute__((aligned(8))); 355 u_short if_index; 356 u_short advrtrs; 357 u_int32_t pad; 358 struct in6_addr advrtr[DRLSTSIZ]; 359 } prefix[PRLSTSIZ]; 360 }; 361 #endif /* BSD_KERNEL_PRIVATE */ 362 363 struct in6_prefix { 364 struct sockaddr_in6 prefix; 365 struct prf_ra raflags; 366 u_char prefixlen; 367 u_char origin; 368 u_long vltime; 369 u_long pltime; 370 u_long expire; 371 u_int32_t flags; 372 int refcnt; 373 u_short if_index; 374 u_short advrtrs; /* number of advertisement routers */ 375 /* struct sockaddr_in6 advrtr[] */ 376 }; 377 378 #if defined(BSD_KERNEL_PRIVATE) 379 struct in6_prefix_32 { 380 struct sockaddr_in6 prefix; 381 struct prf_ra raflags; 382 u_char prefixlen; 383 u_char origin; 384 u_int32_t vltime; 385 u_int32_t pltime; 386 u_int32_t expire; 387 u_int32_t flags; 388 int refcnt; 389 u_short if_index; 390 u_short advrtrs; /* number of advertisement routers */ 391 /* struct sockaddr_in6 advrtr[] */ 392 }; 393 394 struct in6_prefix_64 { 395 struct sockaddr_in6 prefix; 396 struct prf_ra raflags; 397 u_char prefixlen; 398 u_char origin; 399 u_long vltime __attribute__((aligned(8))); 400 u_long pltime __attribute__((aligned(8))); 401 u_long expire __attribute__((aligned(8))); 402 u_int32_t flags __attribute__((aligned(8))); 403 int refcnt; 404 u_short if_index; 405 u_short advrtrs; 406 /* struct sockaddr_in6 advrtr[] */ 407 }; 408 #endif /* BSD_KERNEL_PRIVATE */ 409 410 struct in6_ondireq { 411 char ifname[IFNAMSIZ]; 412 struct { 413 u_int32_t linkmtu; /* LinkMTU */ 414 u_int32_t maxmtu; /* Upper bound of LinkMTU */ 415 u_int32_t basereachable; /* BaseReachableTime */ 416 u_int32_t reachable; /* Reachable Time */ 417 u_int32_t retrans; /* Retrans Timer */ 418 u_int32_t flags; /* Flags */ 419 int recalctm; /* BaseReacable re-calculation timer */ 420 u_int8_t chlim; /* CurHopLimit */ 421 /* Number of routers learned on the interface */ 422 u_int8_t receivedra; 423 /* 424 * The current collision count value 425 * being used for secure address generation. 426 */ 427 u_int8_t collision_count; 428 } ndi; 429 }; 430 431 #if !defined(BSD_KERNEL_PRIVATE) 432 struct in6_ndireq { 433 char ifname[IFNAMSIZ]; 434 struct nd_ifinfo ndi; 435 }; 436 #else 437 struct in6_ndireq { 438 char ifname[IFNAMSIZ]; 439 struct nd_ifinfo_compat ndi; 440 }; 441 #endif /* !BSD_KERNEL_PRIVATE */ 442 443 struct in6_ndifreq { 444 char ifname[IFNAMSIZ]; 445 u_long ifindex; 446 }; 447 448 #define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */ 449 #define RTR_SOLICITATION_INTERVAL 4 /* 4sec */ 450 451 #if defined(BSD_KERNEL_PRIVATE) 452 struct in6_ndifreq_32 { 453 char ifname[IFNAMSIZ]; 454 u_int32_t ifindex; 455 }; 456 457 struct in6_ndifreq_64 { 458 char ifname[IFNAMSIZ]; 459 u_int64_t ifindex __attribute__((aligned(8))); 460 }; 461 #endif /* BSD_KERNEL_PRIVATE */ 462 463 /* Prefix status */ 464 #define NDPRF_ONLINK 0x1 465 #define NDPRF_DETACHED 0x2 466 #define NDPRF_STATIC 0x100 467 #define NDPRF_IFSCOPE 0x1000 468 #define NDPRF_PRPROXY 0x2000 469 #ifdef BSD_KERNEL_PRIVATE 470 #define NDPRF_PROCESSED_ONLINK 0x08000 471 #define NDPRF_PROCESSED_SERVICE 0x10000 472 #define NDPRF_DEFUNCT 0x20000 473 #define NDPRF_CLAT46 0x40000 474 475 #define CLAT46_COLLISION_COUNT_OFFSET 128 476 #endif 477 478 /* protocol constants */ 479 #define MAX_RTR_SOLICITATION_DELAY 1 /* 1sec */ 480 #define RTR_SOLICITATION_INTERVAL 4 /* 4sec */ 481 #define MAX_RTR_SOLICITATIONS 3 482 483 #define ND6_INFINITE_LIFETIME 0xffffffff 484 #define ND6_MAX_LIFETIME 0x7fffffff 485 486 #ifdef BSD_KERNEL_PRIVATE 487 #define ND_IFINFO(ifp) \ 488 ((ifp == NULL) ? NULL : \ 489 ((IN6_IFEXTRA(ifp) == NULL) ? NULL : \ 490 (&IN6_IFEXTRA(ifp)->nd_ifinfo))) 491 492 /* 493 * In a more readable form, we derive linkmtu based on: 494 * 495 * if (ifp == NULL) 496 * linkmtu = IPV6_MMTU 497 * else if (ND_IFINFO(ifp) == NULL || !ND_IFINFO(ifp)->initialized) 498 * linkmtu = ifp->if_mtu; 499 * else if (ND_IFINFO(ifp)->linkmtu && ND_IFINFO(ifp)->linkmtu < ifp->if_mtu) 500 * linkmtu = ND_IFINFO(ifp)->linkmtu; 501 * else if ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < ifp->if_mtu)) 502 * linkmtu = ND_IFINFO(ifp)->maxmtu; 503 * else 504 * linkmtu = ifp->if_mtu; 505 */ 506 #define IN6_LINKMTU(ifp) \ 507 (ifp == NULL ? IPV6_MMTU : \ 508 (ND_IFINFO(ifp) == NULL || !ND_IFINFO(ifp)->initialized) ? \ 509 (ifp)->if_mtu : ((ND_IFINFO(ifp)->linkmtu && \ 510 ND_IFINFO(ifp)->linkmtu < (ifp)->if_mtu) ? ND_IFINFO(ifp)->linkmtu : \ 511 ((ND_IFINFO(ifp)->maxmtu && ND_IFINFO(ifp)->maxmtu < (ifp)->if_mtu) ? \ 512 ND_IFINFO(ifp)->maxmtu : (ifp)->if_mtu))) 513 514 /* node constants */ 515 #define MAX_REACHABLE_TIME 3600000 /* msec */ 516 #define REACHABLE_TIME 30000 /* msec */ 517 #define RETRANS_TIMER 1000 /* msec */ 518 #define MIN_RANDOM_FACTOR 512 /* 1024 * 0.5 */ 519 #define MAX_RANDOM_FACTOR 1536 /* 1024 * 1.5 */ 520 #define DEF_TEMP_VALID_LIFETIME 604800 /* 1 week */ 521 #define DEF_TEMP_PREFERRED_LIFETIME 86400 /* 1 day */ 522 #define TEMPADDR_REGEN_ADVANCE 5 /* sec */ 523 #define MAX_TEMP_DESYNC_FACTOR 600 /* 10 min */ 524 #define ND_COMPUTE_RTIME(x) \ 525 (((MIN_RANDOM_FACTOR * (x >> 10)) + (RandomULong() & \ 526 ((MAX_RANDOM_FACTOR - MIN_RANDOM_FACTOR) * (x >> 10)))) /1000) 527 528 #define IP6_USE_TMPADDR_DEFAULT 1 529 #define IP6_ULA_USE_TMPADDR_DEFAULT 0 530 /* prefix expiry times */ 531 #define ND6_PREFIX_EXPIRY_UNSPEC -1 532 #define ND6_PREFIX_EXPIRY_NEVER 0 533 534 TAILQ_HEAD(nd_drhead, nd_defrouter); 535 struct nd_defrouter { 536 decl_lck_mtx_data(, nddr_lock); 537 decl_lck_mtx_data(, nddr_ref_lock); 538 TAILQ_ENTRY(nd_defrouter) dr_entry; 539 struct in6_addr rtaddr; 540 u_int32_t nddr_refcount; 541 u_int32_t nddr_debug; 542 u_int64_t expire; 543 u_int64_t base_calendartime; /* calendar time at creation */ 544 u_int64_t base_uptime; /* uptime at creation */ 545 u_char flags; /* flags on RA message */ 546 u_char stateflags; 547 u_int32_t rtlifetime; 548 int err; 549 struct ifnet *ifp; 550 struct in6_addr rtaddr_mapped; /* Mapped gateway address for routing */ 551 void (*nddr_trace)(struct nd_defrouter *, int); /* trace callback fn */ 552 }; 553 554 #define NDDR_LOCK_ASSERT_HELD(_nddr) \ 555 LCK_MTX_ASSERT(&(_nddr)->nddr_lock, LCK_MTX_ASSERT_OWNED) 556 557 #define NDDR_LOCK_ASSERT_NOTHELD(_nddr) \ 558 LCK_MTX_ASSERT(&(_nddr)->nddr_lock, LCK_MTX_ASSERT_NOTOWNED) 559 560 #define NDDR_LOCK(_nddr) \ 561 lck_mtx_lock(&(_nddr)->nddr_lock) 562 563 #define NDDR_LOCK_SPIN(_nddr) \ 564 lck_mtx_lock_spin(&(_nddr)->nddr_lock) 565 566 #define NDDR_CONVERT_LOCK(_nddr) do { \ 567 NDPR_LOCK_ASSERT_HELD(_nddr); \ 568 lck_mtx_convert_spin(&(_nddr)->nddr_lock); \ 569 } while (0) 570 571 #define NDDR_UNLOCK(_nddr) \ 572 lck_mtx_unlock(&(_nddr)->nddr_lock) 573 574 #define NDDR_REF_LOCK(_nddr) \ 575 lck_mtx_lock(&(_nddr)->nddr_ref_lock) 576 577 #define NDDR_REF_LOCK_SPIN(_nddr) \ 578 lck_mtx_lock_spin(&(_nddr)->nddr_ref_lock) 579 580 #define NDDR_REF_UNLOCK(_nddr) \ 581 lck_mtx_unlock(&(_nddr)->nddr_ref_lock) 582 583 #define NDDR_ADDREF(_nddr) \ 584 nddr_addref(_nddr) 585 586 #define NDDR_REMREF(_nddr) \ 587 nddr_remref(_nddr) \ 588 589 TAILQ_HEAD(nd_rtihead, nd_route_info); 590 /* 591 * The ordering below is important and it should always start 592 * with nd_drhead as the first element. 593 * It gets passed in as the generic nd_drhead to router management code. 594 * The extra information stored here includes the prefix/prefix-length 595 * which the router list belongs to. 596 */ 597 struct nd_route_info { 598 struct nd_drhead nd_rti_router_list; 599 TAILQ_ENTRY(nd_route_info) nd_rti_entry; 600 struct in6_addr nd_rti_prefix; 601 u_int8_t nd_rti_prefixlen; 602 }; 603 604 struct nd_route_info *ndrti_alloc(void); 605 void nd6_rti_list_wait(const char *); 606 void nd6_rti_list_signal_done(void); 607 void ndrti_free(struct nd_route_info *rti); 608 void nd6_rtilist_remove(struct nd_route_info *); 609 void nd6_rtilist_update(struct nd_route_info *, struct nd_defrouter *); 610 int nd6_rtilist_add(struct nd_route_info *, struct nd_defrouter *, 611 struct nd_route_info **); 612 void nd6_rti_purge(struct nd_route_info *); 613 614 /* define struct prproxy_sols_tree */ 615 RB_HEAD(prproxy_sols_tree, nd6_prproxy_soltgt); 616 617 struct nd_prefix { 618 decl_lck_mtx_data(, ndpr_lock); 619 decl_lck_mtx_data(, ndpr_ref_lock); 620 u_int32_t ndpr_refcount; /* reference count */ 621 u_int32_t ndpr_debug; /* see ifa_debug flags */ 622 struct ifnet *ndpr_ifp; 623 struct rtentry *ndpr_rt; 624 LIST_ENTRY(nd_prefix) ndpr_entry; 625 struct sockaddr_in6 ndpr_prefix; /* prefix */ 626 struct in6_addr ndpr_mask; /* netmask derived from the prefix */ 627 struct in6_addr ndpr_addr; /* address that is derived from the prefix */ 628 u_int32_t ndpr_vltime; /* advertised valid lifetime */ 629 u_int32_t ndpr_pltime; /* advertised preferred lifetime */ 630 u_int64_t ndpr_preferred; /* preferred time of the prefix */ 631 u_int64_t ndpr_expire; /* expiration time of the prefix */ 632 u_int64_t ndpr_lastupdate; /* rx time of last advertisement */ 633 u_int64_t ndpr_base_calendartime; /* calendar time at creation */ 634 u_int64_t ndpr_base_uptime; /* uptime at creation */ 635 struct prf_ra ndpr_flags; 636 unsigned int ndpr_genid; /* protects ndpr_advrtrs */ 637 u_int32_t ndpr_stateflags; /* actual state flags */ 638 /* list of routers that advertise the prefix: */ 639 LIST_HEAD(pr_rtrhead, nd_pfxrouter) ndpr_advrtrs; 640 u_char ndpr_plen; 641 int ndpr_addrcnt; /* reference counter from addresses */ 642 u_int32_t ndpr_allmulti_cnt; /* total all-multi reqs */ 643 u_int32_t ndpr_prproxy_sols_cnt; /* total # of proxied NS */ 644 struct prproxy_sols_tree ndpr_prproxy_sols; /* tree of proxied NS */ 645 void (*ndpr_trace)(struct nd_prefix *, int); /* trace callback fn */ 646 }; 647 648 #define ndpr_next ndpr_entry.le_next 649 650 #define ndpr_raf ndpr_flags 651 #define ndpr_raf_onlink ndpr_flags.onlink 652 #define ndpr_raf_auto ndpr_flags.autonomous 653 #define ndpr_raf_router ndpr_flags.router 654 /* 655 * We keep expired prefix for certain amount of time, for validation purposes. 656 * 1800s = MaxRtrAdvInterval 657 */ 658 #define NDPR_KEEP_EXPIRED (1800 * 2) 659 660 #define NDPR_LOCK_ASSERT_HELD(_ndpr) \ 661 LCK_MTX_ASSERT(&(_ndpr)->ndpr_lock, LCK_MTX_ASSERT_OWNED) 662 663 #define NDPR_LOCK_ASSERT_NOTHELD(_ndpr) \ 664 LCK_MTX_ASSERT(&(_ndpr)->ndpr_lock, LCK_MTX_ASSERT_NOTOWNED) 665 666 #define NDPR_LOCK(_ndpr) \ 667 lck_mtx_lock(&(_ndpr)->ndpr_lock) 668 669 #define NDPR_LOCK_SPIN(_ndpr) \ 670 lck_mtx_lock_spin(&(_ndpr)->ndpr_lock) 671 672 #define NDPR_CONVERT_LOCK(_ndpr) do { \ 673 NDPR_LOCK_ASSERT_HELD(_ndpr); \ 674 lck_mtx_convert_spin(&(_ndpr)->ndpr_lock); \ 675 } while (0) 676 677 #define NDPR_UNLOCK(_ndpr) \ 678 lck_mtx_unlock(&(_ndpr)->ndpr_lock) 679 680 #define NDPR_REF_LOCK(_ndpr) \ 681 lck_mtx_lock(&(_ndpr)->ndpr_ref_lock) 682 683 #define NDPR_REF_LOCK_SPIN(_ndpr) \ 684 lck_mtx_lock_spin(&(_ndpr)->ndpr_ref_lock) 685 686 #define NDPR_REF_UNLOCK(_ndpr) \ 687 lck_mtx_unlock(&(_ndpr)->ndpr_ref_lock) 688 689 #define NDPR_ADDREF(_ndpr) \ 690 ndpr_addref(_ndpr) 691 692 #define NDPR_REMREF(_ndpr) \ 693 ndpr_remref(_ndpr) \ 694 695 /* 696 * Message format for use in obtaining information about prefixes 697 * from inet6 sysctl function 698 */ 699 struct inet6_ndpr_msghdr { 700 u_short inpm_msglen; /* to skip over non-understood messages */ 701 u_char inpm_version; /* future binary compatibility */ 702 u_char inpm_type; /* message type */ 703 struct in6_addr inpm_prefix; 704 u_int32_t prm_vltim; 705 u_int32_t prm_pltime; 706 u_int32_t prm_expire; 707 u_int32_t prm_preferred; 708 struct in6_prflags prm_flags; 709 u_short prm_index; /* index for associated ifp */ 710 u_char prm_plen; /* length of prefix in bits */ 711 }; 712 713 #define prm_raf_onlink prm_flags.prf_ra.onlink 714 #define prm_raf_auto prm_flags.prf_ra.autonomous 715 716 #define prm_statef_onlink prm_flags.prf_state.onlink 717 718 #define prm_rrf_decrvalid prm_flags.prf_rr.decrvalid 719 #define prm_rrf_decrprefd prm_flags.prf_rr.decrprefd 720 721 struct nd_pfxrouter { 722 LIST_ENTRY(nd_pfxrouter) pfr_entry; 723 #define pfr_next pfr_entry.le_next 724 struct nd_defrouter *router; 725 }; 726 727 LIST_HEAD(nd_prhead, nd_prefix); 728 729 struct nd_prefix_list { 730 struct nd_prefix_list *next; 731 struct nd_prefix pr; 732 }; 733 #endif /* BSD_KERNEL_PRIVATE */ 734 735 #if defined(PRIVATE) 736 struct kev_nd6_ndfailure { 737 struct net_event_data link_data; 738 }; 739 740 struct kev_nd6_ndalive { 741 struct net_event_data link_data; 742 }; 743 744 struct nd6_ra_prefix { 745 struct sockaddr_in6 prefix; 746 struct prf_ra raflags; 747 u_int32_t prefixlen; 748 u_int32_t origin; 749 u_int64_t vltime; 750 u_int64_t pltime; 751 u_int64_t expire; 752 u_int32_t flags; 753 u_int32_t refcnt; 754 u_int32_t if_index; 755 u_int32_t pad; 756 }; 757 758 /* ND6 router advertisement valid bits */ 759 #define KEV_ND6_DATA_VALID_MTU (0x1 << 0) 760 #define KEV_ND6_DATA_VALID_PREFIX (0x1 << 1) 761 762 struct kev_nd6_ra_data { 763 u_int32_t mtu; 764 u_int32_t list_index; 765 u_int32_t list_length; 766 u_int32_t flags; 767 struct nd6_ra_prefix prefix; 768 u_int32_t pad; 769 }; 770 771 struct kev_nd6_event { 772 struct net_event_data link_data; 773 struct in6_addr in6_address; 774 uint32_t val; 775 }; 776 777 struct nd6_lookup_ipv6_args { 778 char ifname[IFNAMSIZ]; 779 struct sockaddr_in6 ip6_dest; 780 u_int32_t ll_dest_len; 781 union { 782 char buffer[256]; 783 struct sockaddr_dl _sdl; 784 } ll_dest_; 785 }; 786 #define ll_dest_sdl ll_dest_._sdl 787 788 #endif /* PRIVATE */ 789 790 #if defined(BSD_KERNEL_PRIVATE) 791 /* nd6.c */ 792 extern int nd6_prune; 793 extern int nd6_prune_lazy; 794 extern int nd6_delay; 795 extern int nd6_umaxtries; 796 extern int nd6_mmaxtries; 797 extern int nd6_useloopback; 798 extern int nd6_accept_6to4; 799 extern int nd6_maxnudhint; 800 extern int nd6_gctimer; 801 extern struct llinfo_nd6 llinfo_nd6; 802 extern struct nd_drhead nd_defrouter_list; 803 extern struct nd_rtihead nd_rti_list; 804 extern struct nd_prhead nd_prefix; 805 extern int nd6_debug; 806 extern int nd6_onlink_ns_rfc4861; 807 extern int nd6_optimistic_dad; 808 809 #include <os/log.h> 810 811 #define nd6log0(type, ...) do { os_log_##type(OS_LOG_DEFAULT, __VA_ARGS__); } while (0) 812 #define nd6log(type, ...) do { if (nd6_debug >= 1) os_log_##type(OS_LOG_DEFAULT, __VA_ARGS__); } while (0) 813 #define nd6log2(type, ...) do { if (nd6_debug >= 2) os_log_##type(OS_LOG_DEFAULT, __VA_ARGS__); } while (0) 814 815 #define ND6_OPTIMISTIC_DAD_LINKLOCAL (1 << 0) 816 #define ND6_OPTIMISTIC_DAD_AUTOCONF (1 << 1) 817 #define ND6_OPTIMISTIC_DAD_TEMPORARY (1 << 2) 818 #define ND6_OPTIMISTIC_DAD_DYNAMIC (1 << 3) 819 #define ND6_OPTIMISTIC_DAD_SECURED (1 << 4) 820 #define ND6_OPTIMISTIC_DAD_MANUAL (1 << 5) 821 822 #define ND6_OPTIMISTIC_DAD_DEFAULT \ 823 (ND6_OPTIMISTIC_DAD_LINKLOCAL | ND6_OPTIMISTIC_DAD_AUTOCONF | \ 824 ND6_OPTIMISTIC_DAD_TEMPORARY | ND6_OPTIMISTIC_DAD_DYNAMIC | \ 825 ND6_OPTIMISTIC_DAD_SECURED | ND6_OPTIMISTIC_DAD_MANUAL) 826 827 /* nd6_rtr.c */ 828 extern int nd6_defifindex; 829 extern int ip6_desync_factor; /* seconds */ 830 /* ND6_INFINITE_LIFETIME does not apply to temporary addresses */ 831 extern u_int32_t ip6_temp_preferred_lifetime; /* seconds */ 832 extern u_int32_t ip6_temp_valid_lifetime; /* seconds */ 833 extern int ip6_temp_regen_advance; /* seconds */ 834 835 union nd_opts { 836 struct nd_opt_hdr *nd_opt_array[26]; /* max = Route information option */ 837 struct { 838 struct nd_opt_hdr *zero; 839 struct nd_opt_hdr *src_lladdr; 840 struct nd_opt_hdr *tgt_lladdr; 841 struct nd_opt_prefix_info *pi_beg; /* multiple opts, start */ 842 struct nd_opt_rd_hdr *rh; 843 struct nd_opt_mtu *mtu; 844 struct nd_opt_hdr *__res6; 845 struct nd_opt_hdr *__res7; 846 struct nd_opt_hdr *__res8; 847 struct nd_opt_hdr *__res9; 848 struct nd_opt_hdr *__res10; 849 struct nd_opt_hdr *__res11; 850 struct nd_opt_hdr *__res12; 851 struct nd_opt_hdr *__res13; 852 struct nd_opt_nonce *nonce; 853 struct nd_opt_hdr *__res15; 854 struct nd_opt_hdr *__res16; 855 struct nd_opt_hdr *__res17; 856 struct nd_opt_hdr *__res18; 857 struct nd_opt_hdr *__res19; 858 struct nd_opt_hdr *__res20; 859 struct nd_opt_hdr *__res21; 860 struct nd_opt_hdr *__res22; 861 struct nd_opt_hdr *__res23; 862 struct nd_opt_route_info *rti_beg; 863 struct nd_opt_hdr *__res25; 864 struct nd_opt_hdr *search; /* multiple opts */ 865 struct nd_opt_hdr *last; /* multiple opts */ 866 int done; 867 struct nd_opt_prefix_info *pi_end; /* multiple prefix opts, end */ 868 struct nd_opt_route_info *rti_end; /* multiple route info opts, end */ 869 } nd_opt_each; 870 }; 871 #define nd_opts_src_lladdr nd_opt_each.src_lladdr 872 #define nd_opts_tgt_lladdr nd_opt_each.tgt_lladdr 873 #define nd_opts_pi nd_opt_each.pi_beg 874 #define nd_opts_pi_end nd_opt_each.pi_end 875 #define nd_opts_rh nd_opt_each.rh 876 #define nd_opts_mtu nd_opt_each.mtu 877 #define nd_opts_nonce nd_opt_each.nonce 878 #define nd_opts_rti nd_opt_each.rti_beg 879 #define nd_opts_rti_end nd_opt_each.rti_end 880 #define nd_opts_search nd_opt_each.search 881 #define nd_opts_last nd_opt_each.last 882 #define nd_opts_done nd_opt_each.done 883 884 /* XXX: need nd6_var.h?? */ 885 /* nd6.c */ 886 extern int nd6_sched_timeout_want; 887 extern void nd6_sched_timeout(struct timeval *, struct timeval *); 888 extern void nd6_init(void); 889 extern void nd6_ifreset(struct ifnet *ifp); 890 extern void nd6_ifattach(struct ifnet *); 891 extern int nd6_is_addr_neighbor(struct sockaddr_in6 *, struct ifnet *, int); 892 extern void nd6_option_init(void *, int, union nd_opts *); 893 extern struct nd_opt_hdr *nd6_option(union nd_opts *); 894 extern int nd6_options(union nd_opts *); 895 extern struct rtentry *nd6_lookup(struct in6_addr *, int, struct ifnet *, int); 896 extern void nd6_setmtu(struct ifnet *); 897 extern void nd6_purge(struct ifnet *); 898 extern void nd6_free(struct rtentry *); 899 extern void nd6_nud_hint(struct rtentry *, struct in6_addr *, int); 900 extern int nd6_resolve(struct ifnet *, struct rtentry *, 901 struct mbuf *, struct sockaddr *, u_char *); 902 extern void nd6_rtrequest(int, struct rtentry *, struct sockaddr *); 903 extern int nd6_ioctl(u_long, caddr_t, struct ifnet *); 904 extern void nd6_cache_lladdr(struct ifnet *, struct in6_addr *, 905 char *, int, int, int); 906 extern int nd6_output_list(struct ifnet *, struct ifnet *, struct mbuf *, 907 struct sockaddr_in6 *, struct rtentry *, struct flowadv *); 908 extern int nd6_output(struct ifnet *, struct ifnet *, struct mbuf *, 909 struct sockaddr_in6 *, struct rtentry *, struct flowadv *); 910 extern int nd6_storelladdr(struct ifnet *, struct rtentry *, struct mbuf *, 911 struct sockaddr *, u_char *); 912 extern int nd6_need_cache(struct ifnet *); 913 extern void nd6_drain(void *); 914 extern void nd6_post_msg(u_int32_t, struct nd_prefix_list *, u_int32_t, 915 u_int32_t); 916 extern int nd6_setifinfo(struct ifnet *, u_int32_t, u_int32_t); 917 extern const char *ndcache_state2str(short); 918 extern void ln_setexpire(struct llinfo_nd6 *, uint64_t); 919 920 /* nd6_nbr.c */ 921 extern void nd6_nbr_init(void); 922 extern void nd6_na_input(struct mbuf *, int, int); 923 extern void nd6_na_output(struct ifnet *, const struct in6_addr *, 924 const struct in6_addr *, u_int32_t, int, struct sockaddr *); 925 extern void nd6_ns_input(struct mbuf *, int, int); 926 extern void nd6_ns_output(struct ifnet *, const struct in6_addr *, 927 const struct in6_addr *, struct llinfo_nd6 *, uint8_t *); 928 extern caddr_t nd6_ifptomac(struct ifnet *); 929 extern void nd6_dad_start(struct ifaddr *, int *); 930 extern void nd6_dad_stop(struct ifaddr *); 931 extern void nd6_llreach_alloc(struct rtentry *, struct ifnet *, void *, 932 unsigned int, boolean_t); 933 extern void nd6_llreach_set_reachable(struct ifnet *, void *, unsigned int); 934 extern void nd6_llreach_use(struct llinfo_nd6 *); 935 extern void nd6_alt_node_addr_decompose(struct ifnet *, struct sockaddr *, 936 struct sockaddr_dl *, struct sockaddr_in6 *); 937 extern int nd6_alt_node_present(struct ifnet *, struct sockaddr_in6 *, 938 struct sockaddr_dl *, int32_t, int, int); 939 extern void nd6_alt_node_absent(struct ifnet *, struct sockaddr_in6 *, struct sockaddr_dl *); 940 941 /* nd6_rtr.c */ 942 extern struct in6_ifaddr *in6_pfx_newpersistaddr(struct nd_prefix *, int, 943 int *, boolean_t, uint8_t); 944 extern void nd6_rtr_init(void); 945 extern void nd6_rs_input(struct mbuf *, int, int); 946 extern void nd6_ra_input(struct mbuf *, int, int); 947 extern void prelist_del(struct nd_prefix *); 948 extern struct nd_defrouter *defrtrlist_update(struct nd_defrouter *, 949 struct nd_drhead *); 950 extern void defrouter_select(struct ifnet *, struct nd_drhead *); 951 extern void defrouter_reset(void); 952 extern int defrtrlist_ioctl(u_long, caddr_t); 953 extern void defrtrlist_del(struct nd_defrouter *, struct nd_drhead *); 954 extern int defrtrlist_add_static(struct nd_defrouter *); 955 extern int defrtrlist_del_static(struct nd_defrouter *); 956 extern void prelist_remove(struct nd_prefix *); 957 extern int prelist_update(struct nd_prefix *, struct nd_defrouter *, 958 struct mbuf *, int); 959 extern int nd6_prelist_add(struct nd_prefix *, struct nd_defrouter *, 960 struct nd_prefix **, boolean_t); 961 extern int nd6_prefix_onlink(struct nd_prefix *); 962 extern int nd6_prefix_onlink_scoped(struct nd_prefix *, unsigned int); 963 extern int nd6_prefix_offlink(struct nd_prefix *); 964 extern void pfxlist_onlink_check(void); 965 extern struct nd_defrouter *defrouter_lookup(struct nd_drhead *, 966 struct in6_addr *, struct ifnet *); 967 extern struct nd_prefix *nd6_prefix_lookup(struct nd_prefix *, int); 968 extern int in6_init_prefix_ltimes(struct nd_prefix *ndpr); 969 extern void rt6_flush(struct in6_addr *, struct ifnet *); 970 extern int nd6_setdefaultiface(int); 971 extern int in6_tmpifadd(const struct in6_ifaddr *, int); 972 extern void nddr_addref(struct nd_defrouter *); 973 extern struct nd_defrouter *nddr_remref(struct nd_defrouter *); 974 extern uint64_t nddr_getexpire(struct nd_defrouter *); 975 extern void ndpr_addref(struct nd_prefix *); 976 extern struct nd_prefix *ndpr_remref(struct nd_prefix *); 977 extern uint64_t ndpr_getexpire(struct nd_prefix *); 978 979 /* nd6_prproxy.c */ 980 struct ip6_hdr; 981 extern u_int32_t nd6_prproxy; 982 extern int nd6_if_prproxy(struct ifnet *, boolean_t); 983 extern void nd6_prproxy_prelist_update(struct nd_prefix *, struct nd_prefix *); 984 extern boolean_t nd6_prproxy_ifaddr(struct in6_ifaddr *); 985 extern void nd6_proxy_find_fwdroute(struct ifnet *, struct route_in6 *); 986 extern boolean_t nd6_prproxy_isours(struct mbuf *, struct ip6_hdr *, 987 struct route_in6 *, unsigned int); 988 extern void nd6_prproxy_ns_output(struct ifnet *, struct ifnet *, 989 struct in6_addr *, struct in6_addr *, struct llinfo_nd6 *); 990 extern void nd6_prproxy_ns_input(struct ifnet *, struct in6_addr *, 991 char *, int, struct in6_addr *, struct in6_addr *, uint8_t *nonce); 992 extern void nd6_prproxy_na_input(struct ifnet *, struct in6_addr *, 993 struct in6_addr *, struct in6_addr *, int); 994 extern void nd6_prproxy_sols_reap(struct nd_prefix *); 995 extern void nd6_prproxy_sols_prune(struct nd_prefix *, u_int32_t); 996 extern int nd6_if_disable(struct ifnet *, boolean_t); 997 void in6_ifaddr_set_dadprogress(struct in6_ifaddr *ia); 998 #endif /* BSD_KERNEL_PRIVATE */ 999 1000 #ifdef KERNEL 1001 1002 /* 1003 * @function nd6_lookup_ipv6 1004 * @discussion This function will check the routing table for a cached 1005 * neighbor discovery entry or trigger an neighbor discovery query 1006 * to resolve the IPv6 address to a link-layer address. 1007 * nd entries are stored in the routing table. This function will 1008 * lookup the IPv6 destination in the routing table. If the 1009 * destination requires forwarding to a gateway, the route of the 1010 * gateway will be looked up. The route entry is inspected to 1011 * determine if the link layer destination address is known. If 1012 * unknown, neighbor discovery will be used to resolve the entry. 1013 * @param interface The interface the packet is being sent on. 1014 * @param ip6_dest The IPv6 destination of the packet. 1015 * @param ll_dest On output, the link-layer destination. 1016 * @param ll_dest_len The length of the buffer for ll_dest. 1017 * @param hint Any routing hint passed down from the protocol. 1018 * @param packet The packet being transmitted. 1019 * @result May return an error such as EHOSTDOWN or ENETUNREACH. If 1020 * this function returns EJUSTRETURN, the packet has been queued 1021 * and will be sent when the address is resolved. If any other 1022 * value is returned, the caller is responsible for disposing of 1023 * the packet. 1024 */ 1025 extern errno_t nd6_lookup_ipv6(ifnet_t interface, 1026 const struct sockaddr_in6 *ip6_dest, struct sockaddr_dl *ll_dest, 1027 size_t ll_dest_len, route_t hint, mbuf_t packet); 1028 1029 #endif /* KERNEL */ 1030 1031 /* nd6_send.c */ 1032 #ifdef BSD_KERNEL_PRIVATE 1033 /* 1034 * nd6_send_opmode 1035 * 1036 * value using CGA tx SEND rx SEND 1037 * -------- --------- ------- ------- 1038 * DISABLED NO NO NO 1039 * QUIET YES NO NO 1040 */ 1041 extern int nd6_send_opstate; 1042 1043 #define ND6_SEND_OPMODE_DISABLED 0 1044 #define ND6_SEND_OPMODE_CGA_QUIET 1 1045 1046 #endif /* BSD_KERNEL_PRIVATE */ 1047 #endif /* _NETINET6_ND6_H_ */ 1048