1 /*
2 * Copyright (c) 2000-2022 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) 1980, 1986, 1993
30 * The Regents of the University of California. 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. All advertising materials mentioning features or use of this software
41 * must display the following acknowledgement:
42 * This product includes software developed by the University of
43 * California, Berkeley and its contributors.
44 * 4. Neither the name of the University nor the names of its contributors
45 * may be used to endorse or promote products derived from this software
46 * without specific prior written permission.
47 *
48 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
49 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
50 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
51 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
52 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
53 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
54 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
55 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
56 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
57 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
58 * SUCH DAMAGE.
59 *
60 * @(#)route.h 8.3 (Berkeley) 4/19/94
61 * $FreeBSD: src/sys/net/route.h,v 1.36.2.1 2000/08/16 06:14:23 jayanth Exp $
62 */
63
64 #ifndef _NET_ROUTE_PRIVATE_H_
65 #define _NET_ROUTE_PRIVATE_H_
66 #include <net/route.h>
67 #include <stdint.h>
68 #include <sys/types.h>
69 #include <sys/socket.h>
70 #include <uuid/uuid.h>
71
72 struct route_old {
73 void *ro_rt;
74 uint32_t ro_flags;
75 struct sockaddr ro_dst;
76 };
77
78 #ifdef BSD_KERNEL_PRIVATE
79 #include <kern/locks.h>
80 #include <net/radix.h>
81 #include <sys/eventhandler.h>
82 #include <net/if_dl.h>
83 #include <netinet/in_private.h>
84
85 extern boolean_t trigger_v6_defrtr_select;
86 /*
87 * Kernel resident routing tables.
88 *
89 * The routing tables are initialized when interface addresses
90 * are set by making entries for all directly connected interfaces.
91 */
92
93 /* forward declarations */
94 struct ifnet_llreach_info;
95 struct rt_reach_info;
96
97 /*
98 * IP route structure
99 *
100 * A route consists of a destination address and a reference
101 * to a routing entry. These are often held by protocols
102 * in their control blocks, e.g. inpcb.
103 */
104 struct route {
105 /*
106 * N.B: struct route must begin with ro_{rt, lle, srcia, flags}
107 * because the code does some casts of a 'struct route_in6 *'
108 * to a 'struct route *'.
109 */
110 struct rtentry *ro_rt;
111 struct ifaddr *ro_srcia;
112 uint32_t ro_flags; /* route flags (see below) */
113 struct sockaddr ro_dst;
114 };
115
116 #define ROF_SRCIF_SELECTED 0x0001 /* source interface was selected */
117
118 #define ROUTE_UNUSABLE(_ro) \
119 ((_ro)->ro_rt == NULL || \
120 ((_ro)->ro_rt->rt_flags & (RTF_UP|RTF_CONDEMNED)) != RTF_UP || \
121 RT_GENID_OUTOFSYNC((_ro)->ro_rt))
122
123 #define _ROUTE_RELEASE_COMMON(_ro, _rnh_locked) do { \
124 if ((_ro)->ro_rt != NULL) { \
125 RT_LOCK_ASSERT_NOTHELD((_ro)->ro_rt); \
126 if (_rnh_locked) \
127 rtfree_locked((_ro)->ro_rt); \
128 else \
129 rtfree((_ro)->ro_rt); \
130 (_ro)->ro_rt = NULL; \
131 } \
132 if ((_ro)->ro_srcia != NULL) { \
133 ifa_remref((_ro)->ro_srcia); \
134 (_ro)->ro_srcia = NULL; \
135 (_ro)->ro_flags &= ~ROF_SRCIF_SELECTED; \
136 } \
137 } while (0)
138
139 #define ROUTE_RELEASE_LOCKED(_ro) _ROUTE_RELEASE_COMMON(_ro, TRUE)
140 #define ROUTE_RELEASE(_ro) _ROUTE_RELEASE_COMMON(_ro, FALSE)
141
142 /*
143 * We distinguish between routes to hosts and routes to networks,
144 * preferring the former if available. For each route we infer
145 * the interface to use from the gateway address supplied when
146 * the route was entered. Routes that forward packets through
147 * gateways are marked so that the output routines know to address the
148 * gateway rather than the ultimate destination.
149 */
150
151 #define NRTT_HIST 10
152 /*
153 * Kernel routing entry structure.
154 */
155 struct rtentry {
156 struct radix_node rt_nodes[2]; /* tree glue, and other values */
157 #define rt_node(r) &((r)->rt_nodes[0])
158 #define rt_key(r) SA(rn_get_key(rt_node(r)))
159 #define rt_mask(r) SA(rn_get_mask(rt_node(r)))
160 /*
161 * See bsd/net/route.c for synchronization notes.
162 */
163 decl_lck_mtx_data(, rt_lock); /* lock for routing entry */
164 uint32_t rt_refcnt; /* # held references */
165 uint32_t rt_flags; /* up/down?, host/net */
166 uint32_t rt_genid; /* route generation id */
167 struct sockaddr *rt_gateway; /* value */
168 struct ifnet *rt_ifp; /* the answer: interface to use */
169 struct ifaddr *rt_ifa; /* the answer: interface addr to use */
170 struct sockaddr *rt_genmask; /* for generation of cloned routes */
171 void *rt_llinfo; /* pointer to link level info cache */
172 void (*rt_llinfo_get_ri) /* llinfo get reachability info fn */
173 (struct rtentry *, struct rt_reach_info *);
174 void (*rt_llinfo_get_iflri) /* ifnet llinfo get reach. info fn */
175 (struct rtentry *, struct ifnet_llreach_info *);
176 void (*rt_llinfo_purge)(struct rtentry *); /* llinfo purge fn */
177 void (*rt_llinfo_free)(void *); /* link level info free function */
178 void (*rt_llinfo_refresh) (struct rtentry *); /* expedite llinfo refresh */
179 struct rt_metrics rt_rmx; /* metrics used by rx'ing protocols */
180 #define rt_use rt_rmx.rmx_pksent
181 struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */
182 struct rtentry *rt_parent; /* cloning parent of this route */
183 struct nstat_counts *rt_stats; /* route stats */
184 void (*rt_if_ref_fn)(struct ifnet *, int); /* interface ref func */
185
186 uint32_t *rt_tree_genid; /* ptr to per-tree route_genid */
187 uint64_t rt_expire; /* expiration time in uptime seconds */
188 uint64_t base_calendartime; /* calendar time upon entry creation */
189 uint64_t base_uptime; /* uptime upon entry creation */
190 u_int32_t rtt_hist[NRTT_HIST]; /* RTT history sample by TCP connections */
191 u_int32_t rtt_min; /* minimum RTT computed from history */
192 u_int32_t rtt_expire_ts; /* RTT history expire timestamp */
193 u_int8_t rtt_index; /* Index into RTT history */
194 uint64_t rt_qset_id; /* QSet to route packets to */
195 uint32_t rt_tr_genid; /* Traffic rule gen id used to determine qset_id */
196 /* Event handler context for the rtentrt */
197 struct eventhandler_lists_ctxt rt_evhdlr_ctxt;
198 };
199
200 static inline struct rtentry *
201 __attribute__((always_inline)) __stateful_pure
rn_rtentry(struct radix_node * rn)202 rn_rtentry(struct radix_node *rn)
203 {
204 return __container_of(rn, struct rtentry, rt_nodes[0]);
205 }
206 /* Backward compatibility. */
207 #define RT(r) rn_rtentry((r))
208
209 #define rt_key_free(r) ({ \
210 void *__r __single = rt_key(r); \
211 kfree_data_addr(__r); \
212 })
213
214 enum {
215 ROUTE_STATUS_UPDATE = 1,
216 ROUTE_ENTRY_REFRESH,
217 ROUTE_ENTRY_DELETED,
218 ROUTE_LLENTRY_RESOLVED,
219 ROUTE_LLENTRY_UNREACH,
220 ROUTE_LLENTRY_CHANGED,
221 ROUTE_LLENTRY_STALE,
222 ROUTE_LLENTRY_TIMEDOUT,
223 ROUTE_LLENTRY_DELETED,
224 ROUTE_LLENTRY_EXPIRED,
225 ROUTE_LLENTRY_PROBED,
226 ROUTE_EVHDLR_DEREGISTER,
227 };
228
229 extern const char * route_event2str(int route_event);
230
231 typedef void (*route_event_fn) (struct eventhandler_entry_arg,
232 struct sockaddr *, int, struct sockaddr *, int);
233 EVENTHANDLER_DECLARE(route_event, route_event_fn);
234
235 /*
236 * Synchronize route entry's generation ID with the tree's.
237 */
238 #define RT_GENID_SYNC(_rt) do { \
239 if ((_rt)->rt_tree_genid != NULL) \
240 (_rt)->rt_genid = *(_rt)->rt_tree_genid; \
241 } while (0)
242
243 /*
244 * Indicates whether or not the route entry's generation ID is stale.
245 */
246 #define RT_GENID_OUTOFSYNC(_rt) \
247 ((_rt)->rt_tree_genid != NULL && \
248 *(_rt)->rt_tree_genid != (_rt)->rt_genid)
249
250 enum {
251 ROUTE_OP_READ,
252 ROUTE_OP_WRITE,
253 };
254
255 extern int route_op_entitlement_check(struct socket *, kauth_cred_t, int, boolean_t);
256 #endif /* BSD_KERNEL_PRIVATE */
257
258 struct kev_netevent_apnfallbk_data {
259 pid_t epid; /* effective PID */
260 uuid_t euuid; /* effective UUID */
261 };
262
263 /*
264 * Route reachability info.
265 */
266 struct rt_reach_info {
267 u_int32_t ri_refcnt; /* reference count */
268 u_int32_t ri_probes; /* total # of probes */
269 u_int64_t ri_snd_expire; /* tx expiration (calendar) time */
270 u_int64_t ri_rcv_expire; /* rx expiration (calendar) time */
271 int32_t ri_rssi; /* received signal strength */
272 int32_t ri_lqm; /* link quality metric */
273 int32_t ri_npm; /* node proximity metric */
274 };
275
276
277 /*
278 * Route address information with extra space for "tiny" socket addresses
279 * from the user space. A "tiny" socket address has the `sa_len' field
280 * smaller than the canonical sockaddr structure.
281 * To preserve the type and the bounds safety, such "tiny" addresses
282 * are copied to the `rtix_tiny_addr' field.
283 */
284 struct rt_addrinfo_ext {
285 struct rt_addrinfo rtix_info; /* addr info containing sockaddr array */
286 struct sockaddr rtix_tiny_addr[RTAX_MAX]; /* storage for the "tiny" sockaddr addresss */
287 uint8_t rtix_next_tiny; /* offset of the next "tiny" address */
288 };
289
290 /*
291 * The following is used internally when parsing routing
292 * messages to avoid potential boundary issues when
293 * using shorter structures.
294 */
295 struct rt_msghdr_common {
296 u_short rtm_msglen; /* to skip over non-understood messages */
297 u_char rtm_version; /* future binary compatibility */
298 u_char rtm_type; /* message type */
299 u_short rtm_index; /* index for associated ifp */
300 int rtm_flags; /* flags, incl. kern & message, e.g. DONE */
301 int rtm_addrs; /* bitmask identifying sockaddrs in msg */
302 pid_t rtm_pid; /* identify sender */
303 int rtm_seq; /* for sender to identify action */
304 int rtm_errno; /* why failed */
305 int rtm_use; /* from rtentry */
306 };
307
308 /*
309 * Extended routing message header (private).
310 */
311 struct rt_msghdr_ext {
312 u_short rtm_msglen; /* to skip over non-understood messages */
313 u_char rtm_version; /* future binary compatibility */
314 u_char rtm_type; /* message type */
315 u_int32_t rtm_index; /* index for associated ifp */
316 u_int32_t rtm_flags; /* flags, incl. kern & message, e.g. DONE */
317 u_int32_t rtm_reserved; /* for future use */
318 u_int32_t rtm_addrs; /* bitmask identifying sockaddrs in msg */
319 pid_t rtm_pid; /* identify sender */
320 int rtm_seq; /* for sender to identify action */
321 int rtm_errno; /* why failed */
322 u_int32_t rtm_use; /* from rtentry */
323 u_int32_t rtm_inits; /* which metrics we are initializing */
324 struct rt_metrics rtm_rmx; /* metrics themselves */
325 struct rt_reach_info rtm_ri; /* route reachability info */
326 };
327
328 /*
329 * Message types.
330 */
331 #define RTM_GET_SILENT 0x11
332 #define RTM_GET_EXT 0x15
333
334 /*
335 * Bitmask values for rtm_inits and rmx_locks.
336 */
337 #define RTV_REFRESH_HOST 0x100 /* init host route to expedite refresh */
338
339 /*
340 * For scoped routing; a zero interface scope value means nil/no scope.
341 */
342 #define IFSCOPE_NONE 0
343 #define IFSCOPE_UNKNOWN IFSCOPE_NONE
344
345 /*
346 * Routing statistics.
347 */
348 struct rtstat_64 {
349 uint64_t rts_badredirect; /* bogus redirect calls */
350 uint64_t rts_dynamic; /* routes created by redirects */
351 uint64_t rts_newgateway; /* routes modified by redirects */
352 uint64_t rts_unreach; /* lookups which failed */
353 uint64_t rts_wildcard; /* lookups satisfied by a wildcard */
354 uint64_t rts_badrtgwroute; /* route to gateway is not direct */
355 };
356
357 #ifdef BSD_KERNEL_PRIVATE
358 /*
359 * Generic call trace used by some subsystems (e.g. route, ifaddr)
360 */
361 #define CTRACE_STACK_SIZE 8 /* depth of stack trace */
362 #define CTRACE_HIST_SIZE 4 /* refcnt history size */
363 typedef struct ctrace {
364 void *th; /* thread ptr */
365 void *pc[CTRACE_STACK_SIZE]; /* PC stack trace */
366 } ctrace_t;
367
368 extern void ctrace_record(ctrace_t *);
369
370 #define RT_LOCK_ASSERT_HELD(_rt) \
371 LCK_MTX_ASSERT(&(_rt)->rt_lock, LCK_MTX_ASSERT_OWNED)
372
373 #define RT_LOCK_ASSERT_NOTHELD(_rt) \
374 LCK_MTX_ASSERT(&(_rt)->rt_lock, LCK_MTX_ASSERT_NOTOWNED)
375
376 #define RT_LOCK(_rt) do { \
377 rt_lock(_rt, FALSE); \
378 } while (0)
379
380 #define RT_LOCK_SPIN(_rt) do { \
381 rt_lock(_rt, TRUE); \
382 } while (0)
383
384 #define RT_CONVERT_LOCK(_rt) do { \
385 RT_LOCK_ASSERT_HELD(_rt); \
386 lck_mtx_convert_spin(&(_rt)->rt_lock); \
387 } while (0)
388
389 #define RT_UNLOCK(_rt) do { \
390 rt_unlock(_rt); \
391 } while (0)
392
393 #define RT_ADDREF_LOCKED(_rt) do { \
394 rtref(_rt); \
395 } while (0)
396
397 /*
398 * Spin variant mutex is used here; caller is responsible for
399 * converting any previously-held similar lock to full mutex.
400 */
401 #define RT_ADDREF(_rt) do { \
402 RT_LOCK_SPIN(_rt); \
403 RT_ADDREF_LOCKED(_rt); \
404 RT_UNLOCK(_rt); \
405 } while (0)
406
407 #define RT_REMREF_LOCKED(_rt) do { \
408 (void) rtunref(_rt); \
409 } while (0)
410
411 /*
412 * Spin variant mutex is used here; caller is responsible for
413 * converting any previously-held similar lock to full mutex.
414 */
415 #define RT_REMREF(_rt) do { \
416 RT_LOCK_SPIN(_rt); \
417 RT_REMREF_LOCKED(_rt); \
418 RT_UNLOCK(_rt); \
419 } while (0)
420
421 /*
422 * This macro calculates skew in wall clock, just in case the user changes the
423 * system time. This skew adjustment is required because we now keep the
424 * expiration times in uptime terms in the kernel, but the userland still
425 * expects expiration times in terms of calendar times. This is used when
426 * reporting rt_expire, ln_expire, etc. values to user space.
427 */
428 #define NET_CALCULATE_CLOCKSKEW(cc, ic, cu, iu) \
429 ((cc.tv_sec - ic) - (cu - iu))
430
431 extern unsigned int rt_verbose;
432 extern struct radix_node_head *rt_tables[AF_MAX + 1];
433 extern lck_mtx_t rnh_lock_data;
434 #define rnh_lock (&rnh_lock_data)
435 extern uint32_t route_genid_inet; /* INET route generation count */
436 extern uint32_t route_genid_inet6; /* INET6 route generation count */
437 extern int rttrash;
438 extern unsigned int rte_debug;
439
440 struct ifmultiaddr;
441 struct proc;
442
443 extern void route_init(void);
444 extern void routegenid_update(void);
445 extern void routegenid_inet_update(void);
446 extern void routegenid_inet6_update(void);
447 extern void rt_ifmsg(struct ifnet *);
448 extern void rt_missmsg(u_char, struct rt_addrinfo *, int, int);
449 extern void rt_newaddrmsg(u_char, struct ifaddr *, int, struct rtentry *);
450 extern void rt_newmaddrmsg(u_char, struct ifmultiaddr *);
451 extern int rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *);
452 extern void set_primary_ifscope(int, unsigned int);
453 extern unsigned int get_primary_ifscope(int);
454 extern boolean_t rt_primary_default(struct rtentry *, struct sockaddr *);
455 extern struct rtentry *rt_lookup(boolean_t, struct sockaddr *,
456 struct sockaddr *, struct radix_node_head *, unsigned int);
457 extern struct rtentry *rt_lookup_coarse(boolean_t, struct sockaddr *,
458 struct sockaddr *, struct radix_node_head *);
459 extern void rtalloc(struct route *);
460 extern void rtalloc_scoped(struct route *, unsigned int);
461 extern void rtalloc_ign(struct route *, uint32_t);
462 extern void rtalloc_scoped_ign(struct route *, uint32_t, unsigned int);
463 extern struct rtentry *rtalloc1(struct sockaddr *, int, uint32_t);
464 extern struct rtentry *rtalloc1_scoped(struct sockaddr *, int, uint32_t,
465 unsigned int);
466 extern struct rtentry *rtalloc1_scoped_locked(struct sockaddr *, int,
467 uint32_t, unsigned int);
468 extern void rtfree_locked(struct rtentry *);
469 extern void rtfree(struct rtentry *);
470 extern void rtref(struct rtentry *);
471 /*
472 * rtunref will decrement the refcount, rtfree will decrement and free if
473 * the refcount has reached zero and the route is not up.
474 * Unless you have good reason to do otherwise, use rtfree.
475 */
476 extern int rtunref(struct rtentry *);
477 extern void rtsetifa(struct rtentry *, struct ifaddr *);
478 extern int rtinit(struct ifaddr *, uint8_t, int);
479 extern int rtinit_locked(struct ifaddr *, uint8_t, int);
480 extern int rtioctl(unsigned long req, caddr_t __sized_by(IOCPARM_LEN(req)), struct proc *);
481 extern void rtredirect(struct ifnet *, struct sockaddr *, struct sockaddr *,
482 struct sockaddr *, int, struct sockaddr *, struct rtentry **);
483 extern int rtrequest(int, struct sockaddr *,
484 struct sockaddr *, struct sockaddr *, int, struct rtentry **);
485 extern int rtrequest_scoped(int, struct sockaddr *, struct sockaddr *,
486 struct sockaddr *, int, struct rtentry **, unsigned int);
487 extern int rtrequest_locked(int, struct sockaddr *,
488 struct sockaddr *, struct sockaddr *, int, struct rtentry **);
489 extern int rtrequest_scoped_locked(int, struct sockaddr *, struct sockaddr *,
490 struct sockaddr *, int, struct rtentry **, unsigned int);
491 extern void sin_set_ifscope(struct sockaddr *, unsigned int);
492 extern unsigned int sin_get_ifscope(struct sockaddr *);
493 extern unsigned int sin6_get_ifscope(struct sockaddr *);
494 extern void rt_lock(struct rtentry *, boolean_t);
495 extern void rt_unlock(struct rtentry *);
496 extern struct sockaddr *rtm_scrub(int, int, struct sockaddr *,
497 struct sockaddr *, void *buf __sized_by(buflen), uint32_t buflen, kauth_cred_t *);
498 extern boolean_t rt_validate(struct rtentry *);
499 extern void rt_set_proxy(struct rtentry *, boolean_t);
500 extern void rt_set_gwroute(struct rtentry *, struct sockaddr *,
501 struct rtentry *);
502 extern void rt_revalidate_gwroute(struct rtentry *, struct rtentry *);
503 extern errno_t route_to_gwroute(const struct sockaddr *, struct rtentry *,
504 struct rtentry **);
505 extern void rt_setexpire(struct rtentry *, uint64_t);
506 extern void rt_str(struct rtentry *, char *ds __sized_by(dslen), uint32_t dslen, char *gs __sized_by(gslen), uint32_t gslen);
507 extern const char *rtm2str(int);
508 extern void route_clear(struct route *);
509 extern void route_copyin(struct route *, struct route *, size_t);
510 extern void route_copyout(struct route *, const struct route *, size_t);
511 extern boolean_t rt_ifa_is_dst(struct sockaddr *, struct ifaddr *);
512 extern struct sockaddr *sa_copy(struct sockaddr *, struct sockaddr_storage *,
513 unsigned int *);
514
515 /*
516 * The following is used to enqueue work items for route events
517 * and also used to pass route event while walking the tree
518 */
519 struct route_event {
520 struct rtentry *rt;
521 /*
522 * There's no reference taken on gwrt.
523 * We only use it to check whether we should
524 * point to rt_gateway or the embedded rt_addr
525 * structure.
526 */
527 struct rtentry *gwrt;
528 union {
529 union sockaddr_in_4_6 _rtev_ipaddr;
530 char _rtev_addr_bytes[DLIL_SDLMAXLEN];
531 } rt_addr;
532 uint32_t route_event_code;
533 eventhandler_tag evtag;
534 };
535
536 #define rtev_ipaddr rt_addr._rtev_ipaddr
537 #define rtev_addr_bytes rt_addr._rtev_addr_bytes
538
539 extern void route_event_init(struct route_event *p_route_ev, struct rtentry *rt,
540 struct rtentry *gwrt, int route_ev_code);
541 extern int route_event_walktree(struct radix_node *rn, void *arg);
542 extern void route_event_enqueue_nwk_wq_entry(struct rtentry *, struct rtentry *,
543 uint32_t, eventhandler_tag, boolean_t);
544 extern uint64_t rt_lookup_qset_id(route_t, bool);
545
546 #endif /* BSD_KERNEL_PRIVATE */
547 #endif /* _NET_ROUTE_PRIVATE_H_ */
548