route.h revision 182801
1139823Simp/*-
21541Srgrimes * Copyright (c) 1980, 1986, 1993
31541Srgrimes *	The Regents of the University of California.  All rights reserved.
41541Srgrimes *
51541Srgrimes * Redistribution and use in source and binary forms, with or without
61541Srgrimes * modification, are permitted provided that the following conditions
71541Srgrimes * are met:
81541Srgrimes * 1. Redistributions of source code must retain the above copyright
91541Srgrimes *    notice, this list of conditions and the following disclaimer.
101541Srgrimes * 2. Redistributions in binary form must reproduce the above copyright
111541Srgrimes *    notice, this list of conditions and the following disclaimer in the
121541Srgrimes *    documentation and/or other materials provided with the distribution.
131541Srgrimes * 4. Neither the name of the University nor the names of its contributors
141541Srgrimes *    may be used to endorse or promote products derived from this software
151541Srgrimes *    without specific prior written permission.
161541Srgrimes *
171541Srgrimes * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
181541Srgrimes * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
191541Srgrimes * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
201541Srgrimes * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
211541Srgrimes * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
221541Srgrimes * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
231541Srgrimes * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
241541Srgrimes * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
251541Srgrimes * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
261541Srgrimes * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
271541Srgrimes * SUCH DAMAGE.
281541Srgrimes *
2985052Sru *	@(#)route.h	8.4 (Berkeley) 1/9/95
3050477Speter * $FreeBSD: head/sys/net/route.h 182801 2008-09-05 21:03:19Z julian $
311541Srgrimes */
321541Srgrimes
332168Spaul#ifndef _NET_ROUTE_H_
342168Spaul#define _NET_ROUTE_H_
352168Spaul
361541Srgrimes/*
371541Srgrimes * Kernel resident routing tables.
388876Srgrimes *
391541Srgrimes * The routing tables are initialized when interface addresses
401541Srgrimes * are set by making entries for all directly connected interfaces.
411541Srgrimes */
421541Srgrimes
431541Srgrimes/*
441541Srgrimes * A route consists of a destination address and a reference
451541Srgrimes * to a routing entry.  These are often held by protocols
461541Srgrimes * in their control blocks, e.g. inpcb.
471541Srgrimes */
481541Srgrimesstruct route {
491541Srgrimes	struct	rtentry *ro_rt;
501541Srgrimes	struct	sockaddr ro_dst;
511541Srgrimes};
521541Srgrimes
531541Srgrimes/*
541541Srgrimes * These numbers are used by reliable protocols for determining
551541Srgrimes * retransmission behavior and are included in the routing structure.
561541Srgrimes */
57122922Sandrestruct rt_metrics_lite {
58122922Sandre	u_long	rmx_mtu;	/* MTU for this path */
59122922Sandre	u_long	rmx_expire;	/* lifetime for route, e.g. redirect */
60122922Sandre	u_long	rmx_pksent;	/* packets sent using this route */
61122922Sandre};
62122922Sandre
631541Srgrimesstruct rt_metrics {
641541Srgrimes	u_long	rmx_locks;	/* Kernel must leave these values alone */
651541Srgrimes	u_long	rmx_mtu;	/* MTU for this path */
661541Srgrimes	u_long	rmx_hopcount;	/* max hops expected */
671541Srgrimes	u_long	rmx_expire;	/* lifetime for route, e.g. redirect */
6813765Smpp	u_long	rmx_recvpipe;	/* inbound delay-bandwidth product */
6913765Smpp	u_long	rmx_sendpipe;	/* outbound delay-bandwidth product */
701541Srgrimes	u_long	rmx_ssthresh;	/* outbound gateway buffer limit */
711541Srgrimes	u_long	rmx_rtt;	/* estimated round trip time */
721541Srgrimes	u_long	rmx_rttvar;	/* estimated rtt variance */
731541Srgrimes	u_long	rmx_pksent;	/* packets sent using this route */
745791Swollman	u_long	rmx_filler[4];	/* will be used for T/TCP later */
751541Srgrimes};
761541Srgrimes
771541Srgrimes/*
781541Srgrimes * rmx_rtt and rmx_rttvar are stored as microseconds;
791541Srgrimes * RTTTOPRHZ(rtt) converts to a value suitable for use
801541Srgrimes * by a protocol slowtimo counter.
811541Srgrimes */
821541Srgrimes#define	RTM_RTTUNIT	1000000	/* units for rtt, rttvar, as units per sec */
831541Srgrimes#define	RTTTOPRHZ(r)	((r) / (RTM_RTTUNIT / PR_SLOWHZ))
841541Srgrimes
85178888Sjulianextern u_int rt_numfibs;	/* number fo usable routing tables */
86178888Sjulianextern u_int tunnel_fib;	/* tunnels use these */
87178888Sjulianextern u_int fwd_fib;		/* packets being forwarded use these routes */
881541Srgrimes/*
895833Sbde * XXX kernel function pointer `rt_output' is visible to applications.
905833Sbde */
915833Sbdestruct mbuf;
925833Sbde
935833Sbde/*
941541Srgrimes * We distinguish between routes to hosts and routes to networks,
951541Srgrimes * preferring the former if available.  For each route we infer
961541Srgrimes * the interface to use from the gateway address supplied when
971541Srgrimes * the route was entered.  Routes that forward packets through
981541Srgrimes * gateways are marked so that the output routines know to address the
991541Srgrimes * gateway rather than the ultimate destination.
1001541Srgrimes */
1011541Srgrimes#ifndef RNF_NORMAL
1021541Srgrimes#include <net/radix.h>
103178167Sqingli#ifdef RADIX_MPATH
104178167Sqingli#include <net/radix_mpath.h>
1051541Srgrimes#endif
106178167Sqingli#endif
1071541Srgrimesstruct rtentry {
1081541Srgrimes	struct	radix_node rt_nodes[2];	/* tree glue, and other values */
109128454Sluigi	/*
110128454Sluigi	 * XXX struct rtentry must begin with a struct radix_node (or two!)
111128454Sluigi	 * because the code does some casts of a 'struct radix_node *'
112128454Sluigi	 * to a 'struct rtentry *'
113128454Sluigi	 */
114132780Skan#define	rt_key(r)	(*((struct sockaddr **)(&(r)->rt_nodes->rn_key)))
115132780Skan#define	rt_mask(r)	(*((struct sockaddr **)(&(r)->rt_nodes->rn_mask)))
1161541Srgrimes	struct	sockaddr *rt_gateway;	/* value */
1177197Swollman	u_long	rt_flags;		/* up/down?, host/net */
1181541Srgrimes	struct	ifnet *rt_ifp;		/* the answer: interface to use */
119122922Sandre	struct	ifaddr *rt_ifa;		/* the answer: interface address to use */
120127828Sluigi	struct	rt_metrics_lite rt_rmx;	/* metrics used by rx'ing protocols */
121127828Sluigi	long	rt_refcnt;		/* # held references */
1221541Srgrimes	struct	sockaddr *rt_genmask;	/* for generation of cloned routes */
1231541Srgrimes	caddr_t	rt_llinfo;		/* pointer to link level info cache */
1241541Srgrimes	struct	rtentry *rt_gwroute;	/* implied entry for gatewayed routes */
1255791Swollman	struct	rtentry *rt_parent; 	/* cloning parent of this route */
126178888Sjulian	u_int	rt_fibnum;		/* which FIB */
127120727Ssam#ifdef _KERNEL
128120727Ssam	/* XXX ugly, user apps use this definition but don't have a mtx def */
129120727Ssam	struct	mtx rt_mtx;		/* mutex for routing entry */
130120727Ssam#endif
1311541Srgrimes};
1321541Srgrimes
1331541Srgrimes/*
1341541Srgrimes * Following structure necessary for 4.3 compatibility;
1351541Srgrimes * We should eventually move it to a compat file.
1361541Srgrimes */
1371541Srgrimesstruct ortentry {
1381541Srgrimes	u_long	rt_hash;		/* to speed lookups */
1391541Srgrimes	struct	sockaddr rt_dst;	/* key */
1401541Srgrimes	struct	sockaddr rt_gateway;	/* value */
1411541Srgrimes	short	rt_flags;		/* up/down?, host/net */
1421541Srgrimes	short	rt_refcnt;		/* # held references */
1431541Srgrimes	u_long	rt_use;			/* raw # packets forwarded */
1441541Srgrimes	struct	ifnet *rt_ifp;		/* the answer: interface to use */
1451541Srgrimes};
1461541Srgrimes
1474104Swollman#define rt_use rt_rmx.rmx_pksent
1484104Swollman
1491541Srgrimes#define	RTF_UP		0x1		/* route usable */
1501541Srgrimes#define	RTF_GATEWAY	0x2		/* destination is a gateway */
1511541Srgrimes#define	RTF_HOST	0x4		/* host entry (net otherwise) */
1521541Srgrimes#define	RTF_REJECT	0x8		/* host or net unreachable */
1531541Srgrimes#define	RTF_DYNAMIC	0x10		/* created dynamically (by redirect) */
1541541Srgrimes#define	RTF_MODIFIED	0x20		/* modified dynamically (by redirect) */
1551541Srgrimes#define RTF_DONE	0x40		/* message confirmed */
15686764Sjlemon/*			0x80		   unused, was RTF_DELCLONE */
1571541Srgrimes#define RTF_CLONING	0x100		/* generate new routes on use */
1581541Srgrimes#define RTF_XRESOLVE	0x200		/* external daemon resolves name */
15917835Sjulian#define RTF_LLINFO	0x400		/* generated by link layer (e.g. ARP) */
1601541Srgrimes#define RTF_STATIC	0x800		/* manually added */
1611541Srgrimes#define RTF_BLACKHOLE	0x1000		/* just discard pkts (during updates) */
1621541Srgrimes#define RTF_PROTO2	0x4000		/* protocol specific routing flag */
1631541Srgrimes#define RTF_PROTO1	0x8000		/* protocol specific routing flag */
1641541Srgrimes
165122921Sandre/* XXX: temporary to stay API/ABI compatible with userland */
166122921Sandre#ifndef _KERNEL
167122921Sandre#define RTF_PRCLONING	0x10000		/* unused, for compatibility */
168122921Sandre#endif
169122921Sandre
1705099Swollman#define RTF_WASCLONED	0x20000		/* route generated through cloning */
1715099Swollman#define RTF_PROTO3	0x40000		/* protocol specific routing flag */
17218839Swollman/*			0x80000		   unused */
1736245Swollman#define RTF_PINNED	0x100000	/* future use */
17415652Swollman#define	RTF_LOCAL	0x200000 	/* route represents a local address */
17515652Swollman#define	RTF_BROADCAST	0x400000	/* route represents a bcast address */
17615652Swollman#define	RTF_MULTICAST	0x800000	/* route represents a mcast address */
17715652Swollman					/* 0x1000000 and up unassigned */
1781541Srgrimes
179156750Sandre/* Mask of RTF flags that are allowed to be modified by RTM_CHANGE. */
180156750Sandre#define RTF_FMASK	\
181156750Sandre	(RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \
182156750Sandre	 RTF_REJECT | RTF_STATIC)
183156750Sandre
1841541Srgrimes/*
1851541Srgrimes * Routing statistics.
1861541Srgrimes */
1871541Srgrimesstruct	rtstat {
1881541Srgrimes	short	rts_badredirect;	/* bogus redirect calls */
1891541Srgrimes	short	rts_dynamic;		/* routes created by redirects */
1901541Srgrimes	short	rts_newgateway;		/* routes modified by redirects */
1911541Srgrimes	short	rts_unreach;		/* lookups which failed */
1921541Srgrimes	short	rts_wildcard;		/* lookups satisfied by a wildcard */
1931541Srgrimes};
1941541Srgrimes/*
1951541Srgrimes * Structures for routing messages.
1961541Srgrimes */
1971541Srgrimesstruct rt_msghdr {
1981541Srgrimes	u_short	rtm_msglen;	/* to skip over non-understood messages */
1991541Srgrimes	u_char	rtm_version;	/* future binary compatibility */
2001541Srgrimes	u_char	rtm_type;	/* message type */
2011541Srgrimes	u_short	rtm_index;	/* index for associated ifp */
2021541Srgrimes	int	rtm_flags;	/* flags, incl. kern & message, e.g. DONE */
2031541Srgrimes	int	rtm_addrs;	/* bitmask identifying sockaddrs in msg */
2041541Srgrimes	pid_t	rtm_pid;	/* identify sender */
2051541Srgrimes	int	rtm_seq;	/* for sender to identify action */
2061541Srgrimes	int	rtm_errno;	/* why failed */
207156750Sandre	int	rtm_fmask;	/* bitmask used in RTM_CHANGE message */
208156750Sandre#define	rtm_use	rtm_fmask	/* deprecated, use rtm_rmx->rmx_pksent */
2091541Srgrimes	u_long	rtm_inits;	/* which metrics we are initializing */
2101541Srgrimes	struct	rt_metrics rtm_rmx; /* metrics themselves */
2111541Srgrimes};
2121541Srgrimes
2135791Swollman#define RTM_VERSION	5	/* Up the ante and ignore older versions */
2141541Srgrimes
21551252Sru/*
21651252Sru * Message types.
21751252Sru */
2181541Srgrimes#define RTM_ADD		0x1	/* Add Route */
2191541Srgrimes#define RTM_DELETE	0x2	/* Delete Route */
2201541Srgrimes#define RTM_CHANGE	0x3	/* Change Metrics or flags */
2211541Srgrimes#define RTM_GET		0x4	/* Report Metrics */
2221541Srgrimes#define RTM_LOSING	0x5	/* Kernel Suspects Partitioning */
2231541Srgrimes#define RTM_REDIRECT	0x6	/* Told to use different route */
2241541Srgrimes#define RTM_MISS	0x7	/* Lookup failed on this address */
2251541Srgrimes#define RTM_LOCK	0x8	/* fix specified metrics */
2261541Srgrimes#define RTM_OLDADD	0x9	/* caused by SIOCADDRT */
2271541Srgrimes#define RTM_OLDDEL	0xa	/* caused by SIOCDELRT */
2281541Srgrimes#define RTM_RESOLVE	0xb	/* req to resolve dst to LL addr */
2291541Srgrimes#define RTM_NEWADDR	0xc	/* address being added to iface */
2301541Srgrimes#define RTM_DELADDR	0xd	/* address being removed from iface */
2311541Srgrimes#define RTM_IFINFO	0xe	/* iface going up/down etc. */
23221666Swollman#define	RTM_NEWMADDR	0xf	/* mcast group membership being added to if */
23321666Swollman#define	RTM_DELMADDR	0x10	/* mcast group membership being deleted */
23489498Sru#define	RTM_IFANNOUNCE	0x11	/* iface arrival/departure */
235136155Ssam#define	RTM_IEEE80211	0x12	/* IEEE80211 wireless event */
2361541Srgrimes
23751252Sru/*
23851252Sru * Bitmask values for rtm_inits and rmx_locks.
23951252Sru */
2401541Srgrimes#define RTV_MTU		0x1	/* init or lock _mtu */
2411541Srgrimes#define RTV_HOPCOUNT	0x2	/* init or lock _hopcount */
24251252Sru#define RTV_EXPIRE	0x4	/* init or lock _expire */
2431541Srgrimes#define RTV_RPIPE	0x8	/* init or lock _recvpipe */
2441541Srgrimes#define RTV_SPIPE	0x10	/* init or lock _sendpipe */
2451541Srgrimes#define RTV_SSTHRESH	0x20	/* init or lock _ssthresh */
2461541Srgrimes#define RTV_RTT		0x40	/* init or lock _rtt */
2471541Srgrimes#define RTV_RTTVAR	0x80	/* init or lock _rttvar */
2481541Srgrimes
2491541Srgrimes/*
25051252Sru * Bitmask values for rtm_addrs.
2511541Srgrimes */
2521541Srgrimes#define RTA_DST		0x1	/* destination sockaddr present */
2531541Srgrimes#define RTA_GATEWAY	0x2	/* gateway sockaddr present */
2541541Srgrimes#define RTA_NETMASK	0x4	/* netmask sockaddr present */
2551541Srgrimes#define RTA_GENMASK	0x8	/* cloning mask sockaddr present */
2561541Srgrimes#define RTA_IFP		0x10	/* interface name sockaddr present */
2571541Srgrimes#define RTA_IFA		0x20	/* interface addr sockaddr present */
2581541Srgrimes#define RTA_AUTHOR	0x40	/* sockaddr for author of redirect */
2591541Srgrimes#define RTA_BRD		0x80	/* for NEWADDR, broadcast or p-p dest addr */
2601541Srgrimes
2611541Srgrimes/*
2621541Srgrimes * Index offsets for sockaddr array for alternate internal encoding.
2631541Srgrimes */
2641541Srgrimes#define RTAX_DST	0	/* destination sockaddr present */
2651541Srgrimes#define RTAX_GATEWAY	1	/* gateway sockaddr present */
2661541Srgrimes#define RTAX_NETMASK	2	/* netmask sockaddr present */
2671541Srgrimes#define RTAX_GENMASK	3	/* cloning mask sockaddr present */
2681541Srgrimes#define RTAX_IFP	4	/* interface name sockaddr present */
2691541Srgrimes#define RTAX_IFA	5	/* interface addr sockaddr present */
2701541Srgrimes#define RTAX_AUTHOR	6	/* sockaddr for author of redirect */
2711541Srgrimes#define RTAX_BRD	7	/* for NEWADDR, broadcast or p-p dest addr */
2721541Srgrimes#define RTAX_MAX	8	/* size of array to allocate */
2731541Srgrimes
2741541Srgrimesstruct rt_addrinfo {
2751541Srgrimes	int	rti_addrs;
2761541Srgrimes	struct	sockaddr *rti_info[RTAX_MAX];
27785074Sru	int	rti_flags;
27885074Sru	struct	ifaddr *rti_ifa;
27985074Sru	struct	ifnet *rti_ifp;
2801541Srgrimes};
2811541Srgrimes
282128185Sluigi/*
283128185Sluigi * This macro returns the size of a struct sockaddr when passed
284128185Sluigi * through a routing socket. Basically we round up sa_len to
285128185Sluigi * a multiple of sizeof(long), with a minimum of sizeof(long).
286128185Sluigi * The check for a NULL pointer is just a convenience, probably never used.
287128185Sluigi * The case sa_len == 0 should only apply to empty structures.
288128185Sluigi */
289128185Sluigi#define SA_SIZE(sa)						\
290128185Sluigi    (  (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ?	\
291128185Sluigi	sizeof(long)		:				\
292128185Sluigi	1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) )
293128185Sluigi
29455205Speter#ifdef _KERNEL
295117752Shsu
296120727Ssam#define	RT_LOCK_INIT(_rt) \
297120727Ssam	mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK)
298120727Ssam#define	RT_LOCK(_rt)		mtx_lock(&(_rt)->rt_mtx)
299174934Smux#define	RT_TRYLOCK(_rt)		mtx_trylock(&(_rt)->rt_mtx)
300120727Ssam#define	RT_UNLOCK(_rt)		mtx_unlock(&(_rt)->rt_mtx)
301120727Ssam#define	RT_LOCK_DESTROY(_rt)	mtx_destroy(&(_rt)->rt_mtx)
302120727Ssam#define	RT_LOCK_ASSERT(_rt)	mtx_assert(&(_rt)->rt_mtx, MA_OWNED)
303117752Shsu
304122334Ssam#define	RT_ADDREF(_rt)	do {					\
305122334Ssam	RT_LOCK_ASSERT(_rt);					\
306122334Ssam	KASSERT((_rt)->rt_refcnt >= 0,				\
307122334Ssam		("negative refcnt %ld", (_rt)->rt_refcnt));	\
308122334Ssam	(_rt)->rt_refcnt++;					\
309150130Sandre} while (0)
310182801Sjulian
311122334Ssam#define	RT_REMREF(_rt)	do {					\
312122334Ssam	RT_LOCK_ASSERT(_rt);					\
313122334Ssam	KASSERT((_rt)->rt_refcnt > 0,				\
314122334Ssam		("bogus refcnt %ld", (_rt)->rt_refcnt));	\
315122334Ssam	(_rt)->rt_refcnt--;					\
316150130Sandre} while (0)
317122334Ssam
318122334Ssam#define	RTFREE_LOCKED(_rt) do {					\
319122334Ssam		if ((_rt)->rt_refcnt <= 1)			\
320122334Ssam			rtfree(_rt);				\
321122334Ssam		else {						\
322122334Ssam			RT_REMREF(_rt);				\
323122334Ssam			RT_UNLOCK(_rt);				\
324122334Ssam		}						\
325122334Ssam		/* guard against invalid refs */		\
326122334Ssam		_rt = 0;					\
32746568Speter	} while (0)
328182801Sjulian
329122334Ssam#define	RTFREE(_rt) do {					\
330122334Ssam		RT_LOCK(_rt);					\
331122334Ssam		RTFREE_LOCKED(_rt);				\
332120727Ssam	} while (0)
3331541Srgrimes
334178898Sjulianextern struct radix_node_head *rt_tables[][AF_MAX+1];
3351541Srgrimes
33621666Swollmanstruct ifmultiaddr;
33721666Swollman
338136155Ssamvoid	 rt_ieee80211msg(struct ifnet *, int, void *, size_t);
33992725Salfredvoid	 rt_ifannouncemsg(struct ifnet *, int);
34092725Salfredvoid	 rt_ifmsg(struct ifnet *);
34192725Salfredvoid	 rt_missmsg(int, struct rt_addrinfo *, int, int);
34292725Salfredvoid	 rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *);
34392725Salfredvoid	 rt_newmaddrmsg(int, struct ifmultiaddr *);
34492725Salfredint	 rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *);
345128621Sluigi
346128621Sluigi/*
347128621Sluigi * Note the following locking behavior:
348128621Sluigi *
349128621Sluigi *    rtalloc_ign() and rtalloc() return ro->ro_rt unlocked
350128621Sluigi *
351128621Sluigi *    rtalloc1() returns a locked rtentry
352128621Sluigi *
353128621Sluigi *    rtfree() and RTFREE_LOCKED() require a locked rtentry
354128621Sluigi *
355128621Sluigi *    RTFREE() uses an unlocked entry.
356128621Sluigi */
357128621Sluigi
358178888Sjulianint	 rtexpunge(struct rtentry *);
359178888Sjulianvoid	 rtfree(struct rtentry *);
360178888Sjulian
361178888Sjulian/* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */
362178888Sjulian/* Thes are used by old code not yet converted to use multiple FIBS */
363178888Sjulianint	 rt_getifa(struct rt_addrinfo *);
364128621Sluigivoid	 rtalloc_ign(struct route *ro, u_long ignflags);
365128621Sluigivoid	 rtalloc(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */
366120727Ssamstruct rtentry *rtalloc1(struct sockaddr *, int, u_long);
36792725Salfredint	 rtinit(struct ifaddr *, int, int);
36892725Salfredint	 rtioctl(u_long, caddr_t);
36992725Salfredvoid	 rtredirect(struct sockaddr *, struct sockaddr *,
370120727Ssam	    struct sockaddr *, int, struct sockaddr *);
37192725Salfredint	 rtrequest(int, struct sockaddr *,
37292725Salfred	    struct sockaddr *, struct sockaddr *, int, struct rtentry **);
37392725Salfredint	 rtrequest1(int, struct rt_addrinfo *, struct rtentry **);
374111767Smdoddint	 rt_check(struct rtentry **, struct rtentry **, struct sockaddr *);
375174559Skmacy
376178888Sjulian/* defaults to "all" FIBs */
377178888Sjulianint	 rtinit_fib(struct ifaddr *, int, int);
378178888Sjulian
379178888Sjulian/* XXX MRT NEW VERSIONS THAT USE FIBs
380178888Sjulian * For now the protocol indepedent versions are the same as the AF_INET ones
381178888Sjulian * but this will change..
382178888Sjulian */
383178888Sjulianint	 rt_getifa_fib(struct rt_addrinfo *, u_int fibnum);
384178888Sjulianvoid	 rtalloc_ign_fib(struct route *ro, u_long ignflags, u_int fibnum);
385178888Sjulianvoid	 rtalloc_fib(struct route *ro, u_int fibnum);
386178888Sjulianstruct rtentry *rtalloc1_fib(struct sockaddr *, int, u_long, u_int);
387178888Sjulianint	 rtioctl_fib(u_long, caddr_t, u_int);
388178888Sjulianvoid	 rtredirect_fib(struct sockaddr *, struct sockaddr *,
389178888Sjulian	    struct sockaddr *, int, struct sockaddr *, u_int);
390178888Sjulianint	 rtrequest_fib(int, struct sockaddr *,
391178888Sjulian	    struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int);
392178888Sjulianint	 rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int);
393178888Sjulianint	 rt_check_fib(struct rtentry **, struct rtentry **, struct sockaddr *, u_int);
394178888Sjulian
395174559Skmacy#include <sys/eventhandler.h>
396174703Skmacytypedef void (*rtevent_arp_update_fn)(void *, struct rtentry *, uint8_t *, struct sockaddr *);
397174703Skmacytypedef void (*rtevent_redirect_fn)(void *, struct rtentry *, struct rtentry *, struct sockaddr *);
398174703SkmacyEVENTHANDLER_DECLARE(route_arp_update_event, rtevent_arp_update_fn);
399174703SkmacyEVENTHANDLER_DECLARE(route_redirect_event, rtevent_redirect_fn);
4001541Srgrimes#endif
4012168Spaul
4022168Spaul#endif
403