xref: /openbsd/sys/net/route.h (revision eb7afff9)
1 /*	$OpenBSD: route.h,v 1.210 2024/03/31 15:53:12 bluhm Exp $	*/
2 /*	$NetBSD: route.h,v 1.9 1996/02/13 22:00:49 christos Exp $	*/
3 
4 /*
5  * Copyright (c) 1980, 1986, 1993
6  *	The Regents of the University of California.  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 University 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 REGENTS 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 REGENTS 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  *	@(#)route.h	8.3 (Berkeley) 4/19/94
33  */
34 
35 #ifndef _NET_ROUTE_H_
36 #define _NET_ROUTE_H_
37 
38 /*
39  * Locks used to protect struct members in this file:
40  *	I	immutable after creation
41  *	N	net lock
42  *	X	exclusive net lock, or shared net lock + kernel lock
43  *	R	art (rtable) lock
44  *	L	arp/nd6/etc lock for updates, net lock for reads
45  *	T	rttimer_mtx		route timer lists
46  */
47 
48 /*
49  * Kernel resident routing tables.
50  *
51  * The routing tables are initialized when interface addresses
52  * are set by making entries for all directly connected interfaces.
53  */
54 
55 #ifdef _KERNEL
56 /*
57  * These numbers are used by reliable protocols for determining
58  * retransmission behavior and are included in the routing structure.
59  */
60 struct rt_kmetrics {
61 	u_int64_t	rmx_pksent;	/* packets sent using this route */
62 	int64_t		rmx_expire;	/* lifetime for route, e.g. redirect */
63 	u_int		rmx_locks;	/* Kernel must leave these values */
64 	u_int		rmx_mtu;	/* MTU for this path */
65 };
66 #endif
67 
68 /*
69  * Huge version for userland compatibility.
70  */
71 struct rt_metrics {
72 	u_int64_t	rmx_pksent;	/* packets sent using this route */
73 	int64_t		rmx_expire;	/* lifetime for route, e.g. redirect */
74 	u_int		rmx_locks;	/* Kernel must leave these values */
75 	u_int		rmx_mtu;	/* MTU for this path */
76 	u_int		rmx_refcnt;	/* # references hold */
77 	/* some apps may still need these no longer used metrics */
78 	u_int		rmx_hopcount;	/* max hops expected */
79 	u_int		rmx_recvpipe;	/* inbound delay-bandwidth product */
80 	u_int		rmx_sendpipe;	/* outbound delay-bandwidth product */
81 	u_int		rmx_ssthresh;	/* outbound gateway buffer limit */
82 	u_int		rmx_rtt;	/* estimated round trip time */
83 	u_int		rmx_rttvar;	/* estimated rtt variance */
84 	u_int		rmx_pad;
85 };
86 
87 #ifdef _KERNEL
88 /*
89  * rmx_rtt and rmx_rttvar are stored as microseconds;
90  * RTTTOPRHZ(rtt) converts to a value suitable for use
91  * by a protocol slowtimo counter.
92  */
93 #define	RTM_RTTUNIT	1000000	/* units for rtt, rttvar, as units per sec */
94 #define	RTTTOPRHZ(r)	((r) / (RTM_RTTUNIT / PR_SLOWHZ))
95 
96 #include <sys/queue.h>
97 #include <net/rtable.h>
98 
99 struct rttimer;
100 
101 /*
102  * We distinguish between routes to hosts and routes to networks,
103  * preferring the former if available.  For each route we infer
104  * the interface to use from the gateway address supplied when
105  * the route was entered.  Routes that forward packets through
106  * gateways are marked with RTF_GATEWAY so that the output routines
107  * know to address the gateway rather than the ultimate destination.
108  *
109  * How the RT_gw union is used also depends on RTF_GATEWAY. With
110  * RTF_GATEWAY set, rt_gwroute points at the rtentry for the rt_gateway
111  * address. If RTF_GATEWAY is not set, rt_cachecnt contains the
112  * number of RTF_GATEWAY rtentry structs with their rt_gwroute pointing
113  * at this rtentry.
114  */
115 
116 struct rtentry {
117 	struct sockaddr	*rt_dest;	/* [I] destination */
118 	SRPL_ENTRY(rtentry) rt_next;	/* [R] next mpath entry to our dst */
119 	struct sockaddr	*rt_gateway;	/* [X] gateway address */
120 	struct ifaddr	*rt_ifa;	/* [N] interface addr to use */
121 	caddr_t		 rt_llinfo;	/* [L] pointer to link level info or
122 					   an MPLS structure */
123 	union {
124 		struct rtentry	*_nh;	/* [X] rtentry for rt_gateway */
125 		unsigned int	 _ref;	/* [X] # gateway rtentry refs */
126 	} RT_gw;
127 #define rt_gwroute	 RT_gw._nh
128 #define rt_cachecnt	 RT_gw._ref
129 	struct rtentry	*rt_parent;	/* [N] if cloned, parent rtentry */
130 	LIST_HEAD(, rttimer) rt_timer;  /* queue of timeouts for misc funcs */
131 	struct rt_kmetrics rt_rmx;	/* metrics used by rx'ing protocols */
132 	unsigned int	 rt_ifidx;	/* [N] interface to use */
133 	unsigned int	 rt_flags;	/* [X] up/down?, host/net */
134 	struct refcnt	 rt_refcnt;	/* # held references */
135 	int		 rt_plen;	/* [I] prefix length */
136 	uint16_t	 rt_labelid;	/* [N] route label ID */
137 	uint8_t		 rt_priority;	/* [N] routing priority to use */
138 };
139 #define	rt_use		rt_rmx.rmx_pksent
140 #define	rt_expire	rt_rmx.rmx_expire
141 #define	rt_locks	rt_rmx.rmx_locks
142 #define	rt_mtu		rt_rmx.rmx_mtu
143 
144 #endif /* _KERNEL */
145 
146 /* bitmask values for rtm_flags */
147 #define	RTF_UP		0x1		/* route usable */
148 #define	RTF_GATEWAY	0x2		/* destination is a gateway */
149 #define	RTF_HOST	0x4		/* host entry (net otherwise) */
150 #define	RTF_REJECT	0x8		/* host or net unreachable */
151 #define	RTF_DYNAMIC	0x10		/* created dynamically (by redirect) */
152 #define	RTF_MODIFIED	0x20		/* modified dynamically (by redirect) */
153 #define RTF_DONE	0x40		/* message confirmed */
154 #define RTF_CLONING	0x100		/* generate new routes on use */
155 #define RTF_MULTICAST	0x200		/* route associated to a mcast addr. */
156 #define RTF_LLINFO	0x400		/* generated by ARP or ND */
157 #define RTF_STATIC	0x800		/* manually added */
158 #define RTF_BLACKHOLE	0x1000		/* just discard pkts (during updates) */
159 #define RTF_PROTO3	0x2000		/* protocol specific routing flag */
160 #define RTF_PROTO2	0x4000		/* protocol specific routing flag */
161 #define RTF_ANNOUNCE	RTF_PROTO2	/* announce L2 entry */
162 #define RTF_PROTO1	0x8000		/* protocol specific routing flag */
163 #define RTF_CLONED	0x10000		/* this is a cloned route */
164 #define RTF_CACHED	0x20000		/* cached by a RTF_GATEWAY entry */
165 #define RTF_MPATH	0x40000		/* multipath route or operation */
166 #define RTF_MPLS	0x100000	/* MPLS additional infos */
167 #define RTF_LOCAL	0x200000	/* route to a local address */
168 #define RTF_BROADCAST	0x400000	/* route associated to a bcast addr. */
169 #define RTF_CONNECTED	0x800000	/* interface route */
170 #define RTF_BFD		0x1000000	/* Link state controlled by BFD */
171 
172 /* mask of RTF flags that are allowed to be modified by RTM_CHANGE */
173 #define RTF_FMASK	\
174     (RTF_LLINFO | RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \
175      RTF_REJECT | RTF_STATIC | RTF_MPLS | RTF_BFD)
176 
177 /* Routing priorities used by the different routing protocols */
178 #define RTP_NONE	0	/* unset priority use sane default */
179 #define RTP_LOCAL	1	/* local address routes (must be the highest) */
180 #define RTP_CONNECTED	4	/* directly connected routes */
181 #define RTP_STATIC	8	/* static routes base priority */
182 #define RTP_EIGRP	28	/* EIGRP routes */
183 #define RTP_OSPF	32	/* OSPF routes */
184 #define RTP_ISIS	36	/* IS-IS routes */
185 #define RTP_RIP		40	/* RIP routes */
186 #define RTP_BGP		48	/* BGP routes */
187 #define RTP_DEFAULT	56	/* routes that have nothing set */
188 #define RTP_PROPOSAL_STATIC	57
189 #define RTP_PROPOSAL_DHCLIENT	58
190 #define RTP_PROPOSAL_SLAAC	59
191 #define RTP_PROPOSAL_UMB	60
192 #define RTP_PROPOSAL_PPP	61
193 #define RTP_PROPOSAL_SOLICIT	62	/* request reply of all RTM_PROPOSAL */
194 #define RTP_MAX		63	/* maximum priority */
195 #define RTP_ANY		64	/* any of the above */
196 #define RTP_MASK	0x7f
197 #define RTP_DOWN	0x80	/* route/link is down */
198 
199 /*
200  * Routing statistics.
201  */
202 struct	rtstat {
203 	u_int32_t rts_badredirect;	/* bogus redirect calls */
204 	u_int32_t rts_dynamic;		/* routes created by redirects */
205 	u_int32_t rts_newgateway;	/* routes modified by redirects */
206 	u_int32_t rts_unreach;		/* lookups which failed */
207 	u_int32_t rts_wildcard;		/* lookups satisfied by a wildcard */
208 };
209 
210 /*
211  * Routing Table Info.
212  */
213 struct rt_tableinfo {
214 	u_short rti_tableid;	/* routing table id */
215 	u_short rti_domainid;	/* routing domain id */
216 };
217 
218 /*
219  * Structures for routing messages.
220  */
221 struct rt_msghdr {
222 	u_short	rtm_msglen;	/* to skip over non-understood messages */
223 	u_char	rtm_version;	/* future binary compatibility */
224 	u_char	rtm_type;	/* message type */
225 	u_short	rtm_hdrlen;	/* sizeof(rt_msghdr) to skip over the header */
226 	u_short	rtm_index;	/* index for associated ifp */
227 	u_short rtm_tableid;	/* routing table id */
228 	u_char	rtm_priority;	/* routing priority */
229 	u_char	rtm_mpls;	/* MPLS additional infos */
230 	int	rtm_addrs;	/* bitmask identifying sockaddrs in msg */
231 	int	rtm_flags;	/* flags, incl. kern & message, e.g. DONE */
232 	int	rtm_fmask;	/* bitmask used in RTM_CHANGE message */
233 	pid_t	rtm_pid;	/* identify sender */
234 	int	rtm_seq;	/* for sender to identify action */
235 	int	rtm_errno;	/* why failed */
236 	u_int	rtm_inits;	/* which metrics we are initializing */
237 	struct	rt_metrics rtm_rmx; /* metrics themselves */
238 };
239 /* overload no longer used field */
240 #define rtm_use	rtm_rmx.rmx_pksent
241 
242 #define RTM_VERSION	5	/* Up the ante and ignore older versions */
243 
244 #define RTM_MAXSIZE	2048	/* Maximum size of an accepted route msg */
245 
246 /* values for rtm_type */
247 #define RTM_ADD		0x1	/* Add Route */
248 #define RTM_DELETE	0x2	/* Delete Route */
249 #define RTM_CHANGE	0x3	/* Change Metrics or flags */
250 #define RTM_GET		0x4	/* Report Metrics */
251 #define RTM_LOSING	0x5	/* Kernel Suspects Partitioning */
252 #define RTM_REDIRECT	0x6	/* Told to use different route */
253 #define RTM_MISS	0x7	/* Lookup failed on this address */
254 #define RTM_RESOLVE	0xb	/* req to resolve dst to LL addr */
255 #define RTM_NEWADDR	0xc	/* address being added to iface */
256 #define RTM_DELADDR	0xd	/* address being removed from iface */
257 #define RTM_IFINFO	0xe	/* iface going up/down etc. */
258 #define RTM_IFANNOUNCE	0xf	/* iface arrival/departure */
259 #define RTM_DESYNC	0x10	/* route socket buffer overflow */
260 #define RTM_INVALIDATE	0x11	/* Invalidate cache of L2 route */
261 #define RTM_BFD		0x12	/* bidirectional forwarding detection */
262 #define RTM_PROPOSAL	0x13	/* proposal for resolvd(8) */
263 #define RTM_CHGADDRATTR	0x14	/* address attribute change */
264 #define RTM_80211INFO	0x15	/* 80211 iface change */
265 #define RTM_SOURCE	0x16	/* set source address */
266 
267 #define RTV_MTU		0x1	/* init or lock _mtu */
268 #define RTV_HOPCOUNT	0x2	/* init or lock _hopcount */
269 #define RTV_EXPIRE	0x4	/* init or lock _expire */
270 #define RTV_RPIPE	0x8	/* init or lock _recvpipe */
271 #define RTV_SPIPE	0x10	/* init or lock _sendpipe */
272 #define RTV_SSTHRESH	0x20	/* init or lock _ssthresh */
273 #define RTV_RTT		0x40	/* init or lock _rtt */
274 #define RTV_RTTVAR	0x80	/* init or lock _rttvar */
275 
276 /*
277  * Bitmask values for rtm_addrs.
278  */
279 #define RTA_DST		0x1	/* destination sockaddr present */
280 #define RTA_GATEWAY	0x2	/* gateway sockaddr present */
281 #define RTA_NETMASK	0x4	/* netmask sockaddr present */
282 #define RTA_GENMASK	0x8	/* cloning mask sockaddr present */
283 #define RTA_IFP		0x10	/* interface name sockaddr present */
284 #define RTA_IFA		0x20	/* interface addr sockaddr present */
285 #define RTA_AUTHOR	0x40	/* sockaddr for author of redirect */
286 #define RTA_BRD		0x80	/* for NEWADDR, broadcast or p-p dest addr */
287 #define RTA_SRC		0x100	/* source sockaddr present */
288 #define RTA_SRCMASK	0x200	/* source netmask present */
289 #define RTA_LABEL	0x400	/* route label present */
290 #define RTA_BFD		0x800	/* bfd present */
291 #define RTA_DNS		0x1000	/* DNS Servers sockaddr present */
292 #define RTA_STATIC	0x2000	/* RFC 3442 encoded static routes present */
293 #define RTA_SEARCH	0x4000	/* RFC 3397 encoded search path present */
294 
295 /*
296  * Index offsets for sockaddr array for alternate internal encoding.
297  */
298 #define RTAX_DST	0	/* destination sockaddr present */
299 #define RTAX_GATEWAY	1	/* gateway sockaddr present */
300 #define RTAX_NETMASK	2	/* netmask sockaddr present */
301 #define RTAX_GENMASK	3	/* cloning mask sockaddr present */
302 #define RTAX_IFP	4	/* interface name sockaddr present */
303 #define RTAX_IFA	5	/* interface addr sockaddr present */
304 #define RTAX_AUTHOR	6	/* sockaddr for author of redirect */
305 #define RTAX_BRD	7	/* for NEWADDR, broadcast or p-p dest addr */
306 #define RTAX_SRC	8	/* source sockaddr present */
307 #define RTAX_SRCMASK	9	/* source netmask present */
308 #define RTAX_LABEL	10	/* route label present */
309 #define RTAX_BFD	11	/* bfd present */
310 #define RTAX_DNS	12	/* DNS Server(s) sockaddr present */
311 #define RTAX_STATIC	13	/* RFC 3442 encoded static routes present */
312 #define RTAX_SEARCH	14	/* RFC 3397 encoded search path present */
313 #define RTAX_MAX	15	/* size of array to allocate */
314 
315 /*
316  * setsockopt defines used for the filtering.
317  */
318 #define ROUTE_MSGFILTER	1	/* bitmask to specify which types should be
319 				   sent to the client. */
320 #define ROUTE_TABLEFILTER 2	/* change routing table the socket is listening
321 				   on, RTABLE_ANY listens on all tables. */
322 #define ROUTE_PRIOFILTER 3	/* only pass updates with a priority higher or
323 				   equal (actual value lower) to the specified
324 				   priority. */
325 #define ROUTE_FLAGFILTER 4	/* do not pass updates for routes with flags
326 				   in this bitmask. */
327 
328 #define ROUTE_FILTER(m)	(1 << (m))
329 #define RTABLE_ANY	0xffffffff
330 
331 #define	RTLABEL_LEN	32
332 
333 struct sockaddr_rtlabel {
334 	u_int8_t	sr_len;			/* total length */
335 	sa_family_t	sr_family;		/* address family */
336 	char		sr_label[RTLABEL_LEN];
337 };
338 
339 #define	RTDNS_LEN	128
340 
341 struct sockaddr_rtdns {
342 	u_int8_t	sr_len;			/* total length */
343 	sa_family_t	sr_family;		/* address family */
344 	char		sr_dns[RTDNS_LEN];
345 };
346 
347 #ifdef _KERNEL
348 
349 static inline struct sockaddr *
srtdnstosa(struct sockaddr_rtdns * sdns)350 srtdnstosa(struct sockaddr_rtdns *sdns)
351 {
352 	return ((struct sockaddr *)(sdns));
353 }
354 
355 #endif
356 
357 #define	RTSTATIC_LEN	128
358 
359 struct sockaddr_rtstatic {
360 	u_int8_t	sr_len;			/* total length */
361 	sa_family_t	sr_family;		/* address family */
362 	char		sr_static[RTSTATIC_LEN];
363 };
364 
365 #define	RTSEARCH_LEN	128
366 
367 struct sockaddr_rtsearch {
368 	u_int8_t	sr_len;			/* total length */
369 	sa_family_t	sr_family;		/* address family */
370 	char		sr_search[RTSEARCH_LEN];
371 };
372 
373 struct rt_addrinfo {
374 	int	rti_addrs;
375 	const	struct sockaddr *rti_info[RTAX_MAX];
376 	int	rti_flags;
377 	struct	ifaddr *rti_ifa;
378 	struct	rt_msghdr *rti_rtm;
379 	u_char	rti_mpls;
380 };
381 
382 #ifdef __BSD_VISIBLE
383 
384 #include <netinet/in.h>
385 
386 /*
387  * A route consists of a destination address and a reference
388  * to a routing entry.  These are often held by protocols
389  * in their control blocks, e.g. inpcb.
390  */
391 struct route {
392 	struct	rtentry *ro_rt;
393 	u_long		 ro_generation;
394 	u_long		 ro_tableid;	/* u_long because of alignment */
395 	union {
396 		struct	sockaddr	ro_dstsa;
397 		struct	sockaddr_in	ro_dstsin;
398 		struct	sockaddr_in6	ro_dstsin6;
399 	};
400 	union {
401 		struct	in_addr		ro_srcin;
402 		struct	in6_addr	ro_srcin6;
403 	};
404 };
405 
406 #endif /* __BSD_VISIBLE */
407 
408 #ifdef _KERNEL
409 
410 #include <sys/percpu.h>
411 
412 enum rtstat_counters {
413 	rts_badredirect,	/* bogus redirect calls */
414 	rts_dynamic,		/* routes created by redirects */
415 	rts_newgateway,		/* routes modified by redirects */
416 	rts_unreach,		/* lookups which failed */
417 	rts_wildcard,		/* lookups satisfied by a wildcard */
418 
419 	rts_ncounters
420 };
421 
422 static inline void
rtstat_inc(enum rtstat_counters c)423 rtstat_inc(enum rtstat_counters c)
424 {
425 	extern struct cpumem *rtcounters;
426 
427 	counters_inc(rtcounters, c);
428 }
429 
430 /*
431  * This structure, and the prototypes for the rt_timer_{init,remove_all,
432  * add,timer} functions all used with the kind permission of BSDI.
433  * These allow functions to be called for routes at specific times.
434  */
435 struct rttimer_queue {
436 	TAILQ_HEAD(, rttimer)		rtq_head;	/* [T] */
437 	LIST_ENTRY(rttimer_queue)	rtq_link;	/* [T] */
438 	void				(*rtq_func)	/* [I] callback */
439 					    (struct rtentry *, u_int);
440 	unsigned long			rtq_count;	/* [T] */
441 	int				rtq_timeout;	/* [T] */
442 };
443 
444 const char	*rtlabel_id2name_locked(u_int16_t);
445 const char	*rtlabel_id2name(u_int16_t, char *, size_t);
446 u_int16_t	 rtlabel_name2id(const char *);
447 struct sockaddr	*rtlabel_id2sa(u_int16_t, struct sockaddr_rtlabel *);
448 void		 rtlabel_unref(u_int16_t);
449 
450 /*
451  * Values for additional argument to rtalloc()
452  */
453 #define	RT_RESOLVE	1
454 
455 extern struct rtstat rtstat;
456 extern u_long rtgeneration;
457 
458 struct mbuf;
459 struct socket;
460 struct ifnet;
461 struct sockaddr_in6;
462 struct if_ieee80211_data;
463 struct bfd_config;
464 
465 void	 route_init(void);
466 int	 route_cache(struct route *, const struct in_addr *,
467 	    const struct in_addr *, u_int);
468 struct rtentry *route_mpath(struct route *, const struct in_addr *,
469 	    const struct in_addr *, u_int);
470 int	 route6_cache(struct route *, const struct in6_addr *,
471 	    const struct in6_addr *, u_int);
472 struct rtentry *route6_mpath(struct route *, const struct in6_addr *,
473 	    const struct in6_addr *, u_int);
474 void	 rtm_ifchg(struct ifnet *);
475 void	 rtm_ifannounce(struct ifnet *, int);
476 void	 rtm_bfd(struct bfd_config *);
477 void	 rtm_80211info(struct ifnet *, struct if_ieee80211_data *);
478 void	 rt_maskedcopy(struct sockaddr *,
479 	    struct sockaddr *, struct sockaddr *);
480 struct sockaddr *rt_plen2mask(struct rtentry *, struct sockaddr_in6 *);
481 void	 rtm_send(struct rtentry *, int, int, unsigned int);
482 void	 rtm_addr(int, struct ifaddr *);
483 void	 rtm_miss(int, struct rt_addrinfo *, int, uint8_t, u_int, int, u_int);
484 void	 rtm_proposal(struct ifnet *, struct rt_addrinfo *, int, uint8_t);
485 int	 rt_setgate(struct rtentry *, const struct sockaddr *, u_int);
486 struct rtentry *rt_getll(struct rtentry *);
487 
488 void		rt_timer_init(void);
489 int		rt_timer_add(struct rtentry *,
490 		    struct rttimer_queue *, u_int);
491 void		rt_timer_remove_all(struct rtentry *);
492 time_t		rt_timer_get_expire(const struct rtentry *);
493 void		rt_timer_queue_init(struct rttimer_queue *, int,
494 		    void(*)(struct rtentry *, u_int));
495 void		rt_timer_queue_change(struct rttimer_queue *, int);
496 void		rt_timer_queue_flush(struct rttimer_queue *);
497 unsigned long	rt_timer_queue_count(struct rttimer_queue *);
498 void		rt_timer_timer(void *);
499 
500 int	 rt_mpls_set(struct rtentry *, const struct sockaddr *, uint8_t);
501 void	 rt_mpls_clear(struct rtentry *);
502 
503 int	 rtisvalid(struct rtentry *);
504 int	 rt_hash(struct rtentry *, const struct sockaddr *, uint32_t *);
505 struct	 rtentry *rtalloc_mpath(const struct sockaddr *, uint32_t *, u_int);
506 struct	 rtentry *rtalloc(const struct sockaddr *, int, unsigned int);
507 void	 rtref(struct rtentry *);
508 void	 rtfree(struct rtentry *);
509 
510 int	 rt_ifa_add(struct ifaddr *, int, struct sockaddr *, unsigned int);
511 int	 rt_ifa_del(struct ifaddr *, int, struct sockaddr *, unsigned int);
512 void	 rt_ifa_purge(struct ifaddr *);
513 int	 rt_ifa_addlocal(struct ifaddr *);
514 int	 rt_ifa_dellocal(struct ifaddr *);
515 void	 rtredirect(struct sockaddr *, struct sockaddr *, struct sockaddr *,
516 	    struct rtentry **, unsigned int);
517 int	 rtrequest(int, struct rt_addrinfo *, u_int8_t, struct rtentry **,
518 	    u_int);
519 int	 rtrequest_delete(struct rt_addrinfo *, u_int8_t, struct ifnet *,
520 	    struct rtentry **, u_int);
521 int	 rt_if_track(struct ifnet *);
522 int	 rt_if_linkstate_change(struct rtentry *, void *, u_int);
523 int	 rtdeletemsg(struct rtentry *, struct ifnet *, u_int);
524 #endif /* _KERNEL */
525 
526 #endif /* _NET_ROUTE_H_ */
527