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$ 311541Srgrimes */ 321541Srgrimes 332168Spaul#ifndef _NET_ROUTE_H_ 342168Spaul#define _NET_ROUTE_H_ 352168Spaul 36263478Sglebius#include <sys/counter.h> 37263478Sglebius 381541Srgrimes/* 391541Srgrimes * Kernel resident routing tables. 408876Srgrimes * 411541Srgrimes * The routing tables are initialized when interface addresses 421541Srgrimes * are set by making entries for all directly connected interfaces. 431541Srgrimes */ 441541Srgrimes 451541Srgrimes/* 46191148Skmacy * A route consists of a destination address, a reference 47191148Skmacy * to a routing entry, and a reference to an llentry. 48191148Skmacy * These are often held by protocols in their control 49191148Skmacy * blocks, e.g. inpcb. 501541Srgrimes */ 511541Srgrimesstruct route { 521541Srgrimes struct rtentry *ro_rt; 53191117Skmacy struct llentry *ro_lle; 54225698Skmacy struct in_ifaddr *ro_ia; 55225698Skmacy int ro_flags; 561541Srgrimes struct sockaddr ro_dst; 571541Srgrimes}; 581541Srgrimes 59238092Sglebius#define RT_CACHING_CONTEXT 0x1 /* XXX: not used anywhere */ 60238092Sglebius#define RT_NORTREF 0x2 /* doesn't hold reference on ro_rt */ 61225698Skmacy 621541Srgrimesstruct rt_metrics { 631541Srgrimes u_long rmx_locks; /* Kernel must leave these values alone */ 641541Srgrimes u_long rmx_mtu; /* MTU for this path */ 651541Srgrimes u_long rmx_hopcount; /* max hops expected */ 661541Srgrimes u_long rmx_expire; /* lifetime for route, e.g. redirect */ 6713765Smpp u_long rmx_recvpipe; /* inbound delay-bandwidth product */ 6813765Smpp u_long rmx_sendpipe; /* outbound delay-bandwidth product */ 691541Srgrimes u_long rmx_ssthresh; /* outbound gateway buffer limit */ 701541Srgrimes u_long rmx_rtt; /* estimated round trip time */ 711541Srgrimes u_long rmx_rttvar; /* estimated rtt variance */ 721541Srgrimes u_long rmx_pksent; /* packets sent using this route */ 73191080Skmacy u_long rmx_weight; /* route weight */ 74191080Skmacy u_long rmx_filler[3]; /* 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 85231852Sbz#define RT_DEFAULT_FIB 0 /* Explicitly mark fib=0 restricted cases */ 86265711Smelifaro#define RT_ALL_FIBS -1 /* Announce event for every fib */ 87265711Smelifaroextern u_int rt_numfibs; /* number of usable routing tables */ 88265717Smelifaroextern u_int rt_add_addr_allfibs; /* Announce interfaces to all fibs */ 895833Sbde 905833Sbde/* 911541Srgrimes * We distinguish between routes to hosts and routes to networks, 921541Srgrimes * preferring the former if available. For each route we infer 931541Srgrimes * the interface to use from the gateway address supplied when 941541Srgrimes * the route was entered. Routes that forward packets through 951541Srgrimes * gateways are marked so that the output routines know to address the 961541Srgrimes * gateway rather than the ultimate destination. 971541Srgrimes */ 981541Srgrimes#ifndef RNF_NORMAL 991541Srgrimes#include <net/radix.h> 100178167Sqingli#ifdef RADIX_MPATH 101178167Sqingli#include <net/radix_mpath.h> 1021541Srgrimes#endif 103178167Sqingli#endif 104263478Sglebius 105263478Sglebius#if defined(_KERNEL) || defined(_WANT_RTENTRY) 1061541Srgrimesstruct rtentry { 1071541Srgrimes struct radix_node rt_nodes[2]; /* tree glue, and other values */ 108128454Sluigi /* 109128454Sluigi * XXX struct rtentry must begin with a struct radix_node (or two!) 110128454Sluigi * because the code does some casts of a 'struct radix_node *' 111128454Sluigi * to a 'struct rtentry *' 112128454Sluigi */ 113132780Skan#define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key))) 114132780Skan#define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask))) 1151541Srgrimes struct sockaddr *rt_gateway; /* value */ 1161541Srgrimes struct ifnet *rt_ifp; /* the answer: interface to use */ 117122922Sandre struct ifaddr *rt_ifa; /* the answer: interface address to use */ 118263478Sglebius int rt_flags; /* up/down?, host/net */ 119263478Sglebius int rt_refcnt; /* # held references */ 120263478Sglebius u_int rt_fibnum; /* which FIB */ 121263478Sglebius u_long rt_mtu; /* MTU for this path */ 122263478Sglebius u_long rt_weight; /* absolute weight */ 123263478Sglebius u_long rt_expire; /* lifetime for route, e.g. redirect */ 124263478Sglebius#define rt_endzero rt_pksent 125263478Sglebius counter_u64_t rt_pksent; /* packets sent using this route */ 126263478Sglebius struct mtx rt_mtx; /* mutex for routing entry */ 1271541Srgrimes}; 128263478Sglebius#endif /* _KERNEL || _WANT_RTENTRY */ 1291541Srgrimes 1301541Srgrimes#define RTF_UP 0x1 /* route usable */ 1311541Srgrimes#define RTF_GATEWAY 0x2 /* destination is a gateway */ 1321541Srgrimes#define RTF_HOST 0x4 /* host entry (net otherwise) */ 1331541Srgrimes#define RTF_REJECT 0x8 /* host or net unreachable */ 1341541Srgrimes#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ 1351541Srgrimes#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ 1361541Srgrimes#define RTF_DONE 0x40 /* message confirmed */ 13786764Sjlemon/* 0x80 unused, was RTF_DELCLONE */ 138186119Sqingli/* 0x100 unused, was RTF_CLONING */ 1391541Srgrimes#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ 140187094Sqingli#define RTF_LLINFO 0x400 /* DEPRECATED - exists ONLY for backward 141187094Sqingli compatibility */ 142186500Sqingli#define RTF_LLDATA 0x400 /* used by apps to add/del L2 entries */ 1431541Srgrimes#define RTF_STATIC 0x800 /* manually added */ 1441541Srgrimes#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ 1451541Srgrimes#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ 1461541Srgrimes#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ 147264299Sglebius/* 0x10000 unused, was RTF_PRCLONING */ 148186119Sqingli/* 0x20000 unused, was RTF_WASCLONED */ 1495099Swollman#define RTF_PROTO3 0x40000 /* protocol specific routing flag */ 15018839Swollman/* 0x80000 unused */ 151248070Smelifaro#define RTF_PINNED 0x100000 /* route is immutable */ 15215652Swollman#define RTF_LOCAL 0x200000 /* route represents a local address */ 15315652Swollman#define RTF_BROADCAST 0x400000 /* route represents a bcast address */ 15415652Swollman#define RTF_MULTICAST 0x800000 /* route represents a mcast address */ 155191080Skmacy /* 0x8000000 and up unassigned */ 156191080Skmacy#define RTF_STICKY 0x10000000 /* always route dst->src */ 1571541Srgrimes 158191080Skmacy#define RTF_RNH_LOCKED 0x40000000 /* radix node head is locked */ 159191080Skmacy 160252184Sqingli#define RTF_GWFLAG_COMPAT 0x80000000 /* a compatibility bit for interacting 161252184Sqingli with existing routing apps */ 162252184Sqingli 163156750Sandre/* Mask of RTF flags that are allowed to be modified by RTM_CHANGE. */ 164156750Sandre#define RTF_FMASK \ 165156750Sandre (RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \ 166191080Skmacy RTF_REJECT | RTF_STATIC | RTF_STICKY) 167156750Sandre 1681541Srgrimes/* 1691541Srgrimes * Routing statistics. 1701541Srgrimes */ 1711541Srgrimesstruct rtstat { 1721541Srgrimes short rts_badredirect; /* bogus redirect calls */ 1731541Srgrimes short rts_dynamic; /* routes created by redirects */ 1741541Srgrimes short rts_newgateway; /* routes modified by redirects */ 1751541Srgrimes short rts_unreach; /* lookups which failed */ 1761541Srgrimes short rts_wildcard; /* lookups satisfied by a wildcard */ 1771541Srgrimes}; 1781541Srgrimes/* 1791541Srgrimes * Structures for routing messages. 1801541Srgrimes */ 1811541Srgrimesstruct rt_msghdr { 1821541Srgrimes u_short rtm_msglen; /* to skip over non-understood messages */ 1831541Srgrimes u_char rtm_version; /* future binary compatibility */ 1841541Srgrimes u_char rtm_type; /* message type */ 1851541Srgrimes u_short rtm_index; /* index for associated ifp */ 1861541Srgrimes int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ 1871541Srgrimes int rtm_addrs; /* bitmask identifying sockaddrs in msg */ 1881541Srgrimes pid_t rtm_pid; /* identify sender */ 1891541Srgrimes int rtm_seq; /* for sender to identify action */ 1901541Srgrimes int rtm_errno; /* why failed */ 191156750Sandre int rtm_fmask; /* bitmask used in RTM_CHANGE message */ 1921541Srgrimes u_long rtm_inits; /* which metrics we are initializing */ 1931541Srgrimes struct rt_metrics rtm_rmx; /* metrics themselves */ 1941541Srgrimes}; 1951541Srgrimes 196191124Skmacy#define RTM_VERSION 5 /* Up the ante and ignore older versions */ 1971541Srgrimes 19851252Sru/* 19951252Sru * Message types. 20051252Sru */ 2011541Srgrimes#define RTM_ADD 0x1 /* Add Route */ 2021541Srgrimes#define RTM_DELETE 0x2 /* Delete Route */ 2031541Srgrimes#define RTM_CHANGE 0x3 /* Change Metrics or flags */ 2041541Srgrimes#define RTM_GET 0x4 /* Report Metrics */ 2051541Srgrimes#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ 2061541Srgrimes#define RTM_REDIRECT 0x6 /* Told to use different route */ 2071541Srgrimes#define RTM_MISS 0x7 /* Lookup failed on this address */ 2081541Srgrimes#define RTM_LOCK 0x8 /* fix specified metrics */ 209264299Sglebius /* 0x9 */ 210264299Sglebius /* 0xa */ 2111541Srgrimes#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ 2121541Srgrimes#define RTM_NEWADDR 0xc /* address being added to iface */ 2131541Srgrimes#define RTM_DELADDR 0xd /* address being removed from iface */ 2141541Srgrimes#define RTM_IFINFO 0xe /* iface going up/down etc. */ 21521666Swollman#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */ 21621666Swollman#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */ 21789498Sru#define RTM_IFANNOUNCE 0x11 /* iface arrival/departure */ 218136155Ssam#define RTM_IEEE80211 0x12 /* IEEE80211 wireless event */ 2191541Srgrimes 22051252Sru/* 22151252Sru * Bitmask values for rtm_inits and rmx_locks. 22251252Sru */ 2231541Srgrimes#define RTV_MTU 0x1 /* init or lock _mtu */ 2241541Srgrimes#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ 22551252Sru#define RTV_EXPIRE 0x4 /* init or lock _expire */ 2261541Srgrimes#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ 2271541Srgrimes#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ 2281541Srgrimes#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ 2291541Srgrimes#define RTV_RTT 0x40 /* init or lock _rtt */ 2301541Srgrimes#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ 231191080Skmacy#define RTV_WEIGHT 0x100 /* init or lock _weight */ 2321541Srgrimes 2331541Srgrimes/* 23451252Sru * Bitmask values for rtm_addrs. 2351541Srgrimes */ 2361541Srgrimes#define RTA_DST 0x1 /* destination sockaddr present */ 2371541Srgrimes#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ 2381541Srgrimes#define RTA_NETMASK 0x4 /* netmask sockaddr present */ 2391541Srgrimes#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ 2401541Srgrimes#define RTA_IFP 0x10 /* interface name sockaddr present */ 2411541Srgrimes#define RTA_IFA 0x20 /* interface addr sockaddr present */ 2421541Srgrimes#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ 2431541Srgrimes#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ 2441541Srgrimes 2451541Srgrimes/* 2461541Srgrimes * Index offsets for sockaddr array for alternate internal encoding. 2471541Srgrimes */ 2481541Srgrimes#define RTAX_DST 0 /* destination sockaddr present */ 2491541Srgrimes#define RTAX_GATEWAY 1 /* gateway sockaddr present */ 2501541Srgrimes#define RTAX_NETMASK 2 /* netmask sockaddr present */ 2511541Srgrimes#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ 2521541Srgrimes#define RTAX_IFP 4 /* interface name sockaddr present */ 2531541Srgrimes#define RTAX_IFA 5 /* interface addr sockaddr present */ 2541541Srgrimes#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ 2551541Srgrimes#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ 2561541Srgrimes#define RTAX_MAX 8 /* size of array to allocate */ 2571541Srgrimes 2581541Srgrimesstruct rt_addrinfo { 2591541Srgrimes int rti_addrs; 2601541Srgrimes struct sockaddr *rti_info[RTAX_MAX]; 26185074Sru int rti_flags; 26285074Sru struct ifaddr *rti_ifa; 26385074Sru struct ifnet *rti_ifp; 2641541Srgrimes}; 2651541Srgrimes 266128185Sluigi/* 267128185Sluigi * This macro returns the size of a struct sockaddr when passed 268128185Sluigi * through a routing socket. Basically we round up sa_len to 269128185Sluigi * a multiple of sizeof(long), with a minimum of sizeof(long). 270128185Sluigi * The check for a NULL pointer is just a convenience, probably never used. 271128185Sluigi * The case sa_len == 0 should only apply to empty structures. 272128185Sluigi */ 273128185Sluigi#define SA_SIZE(sa) \ 274128185Sluigi ( (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ? \ 275128185Sluigi sizeof(long) : \ 276128185Sluigi 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) ) 277128185Sluigi 27855205Speter#ifdef _KERNEL 279117752Shsu 280205222Sqingli#define RT_LINK_IS_UP(ifp) (!((ifp)->if_capabilities & IFCAP_LINKSTATE) \ 281205024Sqingli || (ifp)->if_link_state == LINK_STATE_UP) 282204902Sqingli 283120727Ssam#define RT_LOCK_INIT(_rt) \ 284120727Ssam mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK) 285120727Ssam#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) 286120727Ssam#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) 287120727Ssam#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) 288120727Ssam#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED) 289263478Sglebius#define RT_UNLOCK_COND(_rt) do { \ 290263478Sglebius if (mtx_owned(&(_rt)->rt_mtx)) \ 291263478Sglebius mtx_unlock(&(_rt)->rt_mtx); \ 292263478Sglebius} while (0) 293117752Shsu 294122334Ssam#define RT_ADDREF(_rt) do { \ 295122334Ssam RT_LOCK_ASSERT(_rt); \ 296122334Ssam KASSERT((_rt)->rt_refcnt >= 0, \ 297186119Sqingli ("negative refcnt %d", (_rt)->rt_refcnt)); \ 298122334Ssam (_rt)->rt_refcnt++; \ 299150130Sandre} while (0) 300182801Sjulian 301122334Ssam#define RT_REMREF(_rt) do { \ 302122334Ssam RT_LOCK_ASSERT(_rt); \ 303122334Ssam KASSERT((_rt)->rt_refcnt > 0, \ 304186119Sqingli ("bogus refcnt %d", (_rt)->rt_refcnt)); \ 305122334Ssam (_rt)->rt_refcnt--; \ 306150130Sandre} while (0) 307122334Ssam 308122334Ssam#define RTFREE_LOCKED(_rt) do { \ 309183017Sjulian if ((_rt)->rt_refcnt <= 1) \ 310183017Sjulian rtfree(_rt); \ 311183017Sjulian else { \ 312183017Sjulian RT_REMREF(_rt); \ 313183017Sjulian RT_UNLOCK(_rt); \ 314183017Sjulian } \ 315183017Sjulian /* guard against invalid refs */ \ 316183017Sjulian _rt = 0; \ 317183017Sjulian} while (0) 318182801Sjulian 319122334Ssam#define RTFREE(_rt) do { \ 320183017Sjulian RT_LOCK(_rt); \ 321183017Sjulian RTFREE_LOCKED(_rt); \ 322183017Sjulian} while (0) 3231541Srgrimes 324238092Sglebius#define RO_RTFREE(_ro) do { \ 325238092Sglebius if ((_ro)->ro_rt) { \ 326238092Sglebius if ((_ro)->ro_flags & RT_NORTREF) { \ 327238092Sglebius (_ro)->ro_flags &= ~RT_NORTREF; \ 328238092Sglebius (_ro)->ro_rt = NULL; \ 329238092Sglebius } else { \ 330238092Sglebius RT_LOCK((_ro)->ro_rt); \ 331238092Sglebius RTFREE_LOCKED((_ro)->ro_rt); \ 332238092Sglebius } \ 333238092Sglebius } \ 334238092Sglebius} while (0) 335238092Sglebius 336193232Sbzstruct radix_node_head *rt_tables_get_rnh(int, int); 3371541Srgrimes 33821666Swollmanstruct ifmultiaddr; 33921666Swollman 340136155Ssamvoid rt_ieee80211msg(struct ifnet *, int, void *, size_t); 34192725Salfredvoid rt_ifannouncemsg(struct ifnet *, int); 34292725Salfredvoid rt_ifmsg(struct ifnet *); 34392725Salfredvoid rt_missmsg(int, struct rt_addrinfo *, int, int); 344225837Sbzvoid rt_missmsg_fib(int, struct rt_addrinfo *, int, int, int); 34592725Salfredvoid rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); 346225837Sbzvoid rt_newaddrmsg_fib(int, struct ifaddr *, int, struct rtentry *, int); 347265717Smelifaroint rt_addrmsg(int, struct ifaddr *, int); 348265717Smelifaroint rt_routemsg(int, struct ifnet *ifp, int, struct rtentry *, int); 34992725Salfredvoid rt_newmaddrmsg(int, struct ifmultiaddr *); 35092725Salfredint rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); 351201282Sqinglivoid rt_maskedcopy(struct sockaddr *, struct sockaddr *, struct sockaddr *); 352128621Sluigi 353265717Smelifaroint rtsock_addrmsg(int, struct ifaddr *, int); 354265717Smelifaroint rtsock_routemsg(int, struct ifnet *ifp, int, struct rtentry *, int); 355265717Smelifaro 356128621Sluigi/* 357128621Sluigi * Note the following locking behavior: 358128621Sluigi * 359128621Sluigi * rtalloc_ign() and rtalloc() return ro->ro_rt unlocked 360128621Sluigi * 361128621Sluigi * rtalloc1() returns a locked rtentry 362128621Sluigi * 363128621Sluigi * rtfree() and RTFREE_LOCKED() require a locked rtentry 364128621Sluigi * 365128621Sluigi * RTFREE() uses an unlocked entry. 366128621Sluigi */ 367128621Sluigi 368178888Sjulianint rtexpunge(struct rtentry *); 369178888Sjulianvoid rtfree(struct rtentry *); 370183013Sjulianint rt_check(struct rtentry **, struct rtentry **, struct sockaddr *); 371178888Sjulian 372178888Sjulian/* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */ 373178888Sjulian/* Thes are used by old code not yet converted to use multiple FIBS */ 374178888Sjulianint rt_getifa(struct rt_addrinfo *); 375128621Sluigivoid rtalloc_ign(struct route *ro, u_long ignflags); 376128621Sluigivoid rtalloc(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */ 377120727Ssamstruct rtentry *rtalloc1(struct sockaddr *, int, u_long); 37892725Salfredint rtinit(struct ifaddr *, int, int); 37992725Salfredint rtioctl(u_long, caddr_t); 38092725Salfredvoid rtredirect(struct sockaddr *, struct sockaddr *, 381120727Ssam struct sockaddr *, int, struct sockaddr *); 38292725Salfredint rtrequest(int, struct sockaddr *, 38392725Salfred struct sockaddr *, struct sockaddr *, int, struct rtentry **); 384174559Skmacy 385178888Sjulian/* XXX MRT NEW VERSIONS THAT USE FIBs 386178888Sjulian * For now the protocol indepedent versions are the same as the AF_INET ones 387178888Sjulian * but this will change.. 388178888Sjulian */ 389178888Sjulianint rt_getifa_fib(struct rt_addrinfo *, u_int fibnum); 390178888Sjulianvoid rtalloc_ign_fib(struct route *ro, u_long ignflags, u_int fibnum); 391178888Sjulianvoid rtalloc_fib(struct route *ro, u_int fibnum); 392178888Sjulianstruct rtentry *rtalloc1_fib(struct sockaddr *, int, u_long, u_int); 393178888Sjulianint rtioctl_fib(u_long, caddr_t, u_int); 394178888Sjulianvoid rtredirect_fib(struct sockaddr *, struct sockaddr *, 395178888Sjulian struct sockaddr *, int, struct sockaddr *, u_int); 396178888Sjulianint rtrequest_fib(int, struct sockaddr *, 397178888Sjulian struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int); 398178888Sjulianint rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int); 399178888Sjulian 400174559Skmacy#include <sys/eventhandler.h> 401174703Skmacytypedef void (*rtevent_arp_update_fn)(void *, struct rtentry *, uint8_t *, struct sockaddr *); 402174703Skmacytypedef void (*rtevent_redirect_fn)(void *, struct rtentry *, struct rtentry *, struct sockaddr *); 403196995Snp/* route_arp_update_event is no longer generated; see arp_update_event */ 404174703SkmacyEVENTHANDLER_DECLARE(route_arp_update_event, rtevent_arp_update_fn); 405174703SkmacyEVENTHANDLER_DECLARE(route_redirect_event, rtevent_redirect_fn); 4061541Srgrimes#endif 4072168Spaul 4082168Spaul#endif 409