route.h revision 178888
1120492Sfjoe/*- 2194638Sdelphij * Copyright (c) 1980, 1986, 1993 3120492Sfjoe * The Regents of the University of California. All rights reserved. 4120492Sfjoe * 5120492Sfjoe * Redistribution and use in source and binary forms, with or without 6120492Sfjoe * modification, are permitted provided that the following conditions 7120492Sfjoe * are met: 8120492Sfjoe * 1. Redistributions of source code must retain the above copyright 9120492Sfjoe * notice, this list of conditions and the following disclaimer. 10120492Sfjoe * 2. Redistributions in binary form must reproduce the above copyright 11120492Sfjoe * notice, this list of conditions and the following disclaimer in the 12120492Sfjoe * documentation and/or other materials provided with the distribution. 13120492Sfjoe * 4. Neither the name of the University nor the names of its contributors 14120492Sfjoe * may be used to endorse or promote products derived from this software 15120492Sfjoe * without specific prior written permission. 16120492Sfjoe * 17120492Sfjoe * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND 18120492Sfjoe * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 19120492Sfjoe * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 20120492Sfjoe * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE 21120492Sfjoe * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 22120492Sfjoe * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 23120492Sfjoe * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 24120492Sfjoe * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 25120492Sfjoe * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 26120492Sfjoe * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 27120492Sfjoe * SUCH DAMAGE. 28120492Sfjoe * 29120492Sfjoe * @(#)route.h 8.4 (Berkeley) 1/9/95 30120492Sfjoe * $FreeBSD: head/sys/net/route.h 178888 2008-05-09 23:03:00Z julian $ 31120492Sfjoe */ 32120492Sfjoe 33120492Sfjoe#ifndef _NET_ROUTE_H_ 34120492Sfjoe#define _NET_ROUTE_H_ 35120492Sfjoe 36120492Sfjoe/* 37120492Sfjoe * Kernel resident routing tables. 38120492Sfjoe * 39120492Sfjoe * The routing tables are initialized when interface addresses 40120492Sfjoe * are set by making entries for all directly connected interfaces. 41120492Sfjoe */ 42120492Sfjoe 43120492Sfjoe/* 44194638Sdelphij * A route consists of a destination address and a reference 45120492Sfjoe * to a routing entry. These are often held by protocols 46120492Sfjoe * in their control blocks, e.g. inpcb. 47120492Sfjoe */ 48194638Sdelphijstruct route { 49120492Sfjoe struct rtentry *ro_rt; 50120492Sfjoe struct sockaddr ro_dst; 51120492Sfjoe}; 52120492Sfjoe 53120492Sfjoe/* 54120492Sfjoe * These numbers are used by reliable protocols for determining 55120492Sfjoe * retransmission behavior and are included in the routing structure. 56120492Sfjoe */ 57120492Sfjoestruct rt_metrics_lite { 58120492Sfjoe u_long rmx_mtu; /* MTU for this path */ 59120492Sfjoe u_long rmx_expire; /* lifetime for route, e.g. redirect */ 60120492Sfjoe u_long rmx_pksent; /* packets sent using this route */ 61194638Sdelphij}; 62120492Sfjoe 63237698Sgaborstruct rt_metrics { 64120492Sfjoe u_long rmx_locks; /* Kernel must leave these values alone */ 65120492Sfjoe u_long rmx_mtu; /* MTU for this path */ 66120492Sfjoe u_long rmx_hopcount; /* max hops expected */ 67120492Sfjoe u_long rmx_expire; /* lifetime for route, e.g. redirect */ 68237698Sgabor u_long rmx_recvpipe; /* inbound delay-bandwidth product */ 69237698Sgabor u_long rmx_sendpipe; /* outbound delay-bandwidth product */ 70237698Sgabor u_long rmx_ssthresh; /* outbound gateway buffer limit */ 71237698Sgabor u_long rmx_rtt; /* estimated round trip time */ 72237698Sgabor u_long rmx_rttvar; /* estimated rtt variance */ 73237698Sgabor u_long rmx_pksent; /* packets sent using this route */ 74237698Sgabor u_long rmx_filler[4]; /* will be used for T/TCP later */ 75120492Sfjoe}; 76120492Sfjoe 77120492Sfjoe/* 78120492Sfjoe * rmx_rtt and rmx_rttvar are stored as microseconds; 79120492Sfjoe * RTTTOPRHZ(rtt) converts to a value suitable for use 80120492Sfjoe * by a protocol slowtimo counter. 81194638Sdelphij */ 82120492Sfjoe#define RTM_RTTUNIT 1000000 /* units for rtt, rttvar, as units per sec */ 83148717Sstefanf#define RTTTOPRHZ(r) ((r) / (RTM_RTTUNIT / PR_SLOWHZ)) 84148717Sstefanf 85230196Skevlo#define RT_MAXFIBS 16 86120492Sfjoeextern u_int rt_numfibs; /* number fo usable routing tables */ 87230196Skevloextern u_int tunnel_fib; /* tunnels use these */ 88230196Skevloextern u_int fwd_fib; /* packets being forwarded use these routes */ 89230196Skevlo/* 90230196Skevlo * XXX kernel function pointer `rt_output' is visible to applications. 91230196Skevlo */ 92230196Skevlostruct mbuf; 93230196Skevlo 94230196Skevlo/* 95230196Skevlo * We distinguish between routes to hosts and routes to networks, 96230196Skevlo * preferring the former if available. For each route we infer 97230196Skevlo * the interface to use from the gateway address supplied when 98194638Sdelphij * the route was entered. Routes that forward packets through 99194638Sdelphij * gateways are marked so that the output routines know to address the 100120492Sfjoe * gateway rather than the ultimate destination. 101194638Sdelphij */ 102194638Sdelphij#ifndef RNF_NORMAL 103194638Sdelphij#include <net/radix.h> 104194638Sdelphij#ifdef RADIX_MPATH 105120492Sfjoe#include <net/radix_mpath.h> 106120492Sfjoe#endif 107120492Sfjoe#endif 108120492Sfjoestruct rtentry { 109120492Sfjoe struct radix_node rt_nodes[2]; /* tree glue, and other values */ 110120492Sfjoe /* 111120492Sfjoe * XXX struct rtentry must begin with a struct radix_node (or two!) 112120492Sfjoe * because the code does some casts of a 'struct radix_node *' 113120492Sfjoe * to a 'struct rtentry *' 114120492Sfjoe */ 115120492Sfjoe#define rt_key(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_key))) 116120492Sfjoe#define rt_mask(r) (*((struct sockaddr **)(&(r)->rt_nodes->rn_mask))) 117120492Sfjoe struct sockaddr *rt_gateway; /* value */ 118120492Sfjoe u_long rt_flags; /* up/down?, host/net */ 119120492Sfjoe struct ifnet *rt_ifp; /* the answer: interface to use */ 120120492Sfjoe struct ifaddr *rt_ifa; /* the answer: interface address to use */ 121120492Sfjoe struct rt_metrics_lite rt_rmx; /* metrics used by rx'ing protocols */ 122120492Sfjoe long rt_refcnt; /* # held references */ 123120492Sfjoe struct sockaddr *rt_genmask; /* for generation of cloned routes */ 124120492Sfjoe caddr_t rt_llinfo; /* pointer to link level info cache */ 125120492Sfjoe struct rtentry *rt_gwroute; /* implied entry for gatewayed routes */ 126120492Sfjoe struct rtentry *rt_parent; /* cloning parent of this route */ 127120492Sfjoe u_int rt_fibnum; /* which FIB */ 128123293Sfjoe#ifdef _KERNEL 129123293Sfjoe /* XXX ugly, user apps use this definition but don't have a mtx def */ 130123293Sfjoe struct mtx rt_mtx; /* mutex for routing entry */ 131194638Sdelphij#endif 132123293Sfjoe}; 133123293Sfjoe 134123293Sfjoe/* 135123293Sfjoe * Following structure necessary for 4.3 compatibility; 136123293Sfjoe * We should eventually move it to a compat file. 137123293Sfjoe */ 138123293Sfjoestruct ortentry { 139123293Sfjoe u_long rt_hash; /* to speed lookups */ 140123293Sfjoe struct sockaddr rt_dst; /* key */ 141194638Sdelphij struct sockaddr rt_gateway; /* value */ 142194638Sdelphij short rt_flags; /* up/down?, host/net */ 143194638Sdelphij short rt_refcnt; /* # held references */ 144194638Sdelphij u_long rt_use; /* raw # packets forwarded */ 145194638Sdelphij struct ifnet *rt_ifp; /* the answer: interface to use */ 146194638Sdelphij}; 147194638Sdelphij 148194638Sdelphij#define rt_use rt_rmx.rmx_pksent 149123293Sfjoe 150123293Sfjoe#define RTF_UP 0x1 /* route usable */ 151123293Sfjoe#define RTF_GATEWAY 0x2 /* destination is a gateway */ 152120492Sfjoe#define RTF_HOST 0x4 /* host entry (net otherwise) */ 153120492Sfjoe#define RTF_REJECT 0x8 /* host or net unreachable */ 154120492Sfjoe#define RTF_DYNAMIC 0x10 /* created dynamically (by redirect) */ 155120492Sfjoe#define RTF_MODIFIED 0x20 /* modified dynamically (by redirect) */ 156120492Sfjoe#define RTF_DONE 0x40 /* message confirmed */ 157120492Sfjoe/* 0x80 unused, was RTF_DELCLONE */ 158120492Sfjoe#define RTF_CLONING 0x100 /* generate new routes on use */ 159120492Sfjoe#define RTF_XRESOLVE 0x200 /* external daemon resolves name */ 160120492Sfjoe#define RTF_LLINFO 0x400 /* generated by link layer (e.g. ARP) */ 161120492Sfjoe#define RTF_STATIC 0x800 /* manually added */ 162120492Sfjoe#define RTF_BLACKHOLE 0x1000 /* just discard pkts (during updates) */ 163148717Sstefanf#define RTF_PROTO2 0x4000 /* protocol specific routing flag */ 164120492Sfjoe#define RTF_PROTO1 0x8000 /* protocol specific routing flag */ 165120492Sfjoe 166120492Sfjoe/* XXX: temporary to stay API/ABI compatible with userland */ 167120492Sfjoe#ifndef _KERNEL 168126949Sbde#define RTF_PRCLONING 0x10000 /* unused, for compatibility */ 169126949Sbde#endif 170120492Sfjoe 171120492Sfjoe#define RTF_WASCLONED 0x20000 /* route generated through cloning */ 172120492Sfjoe#define RTF_PROTO3 0x40000 /* protocol specific routing flag */ 173120492Sfjoe/* 0x80000 unused */ 174120492Sfjoe#define RTF_PINNED 0x100000 /* future use */ 175120492Sfjoe#define RTF_LOCAL 0x200000 /* route represents a local address */ 176120492Sfjoe#define RTF_BROADCAST 0x400000 /* route represents a bcast address */ 177120492Sfjoe#define RTF_MULTICAST 0x800000 /* route represents a mcast address */ 178120492Sfjoe /* 0x1000000 and up unassigned */ 179120492Sfjoe 180120492Sfjoe/* Mask of RTF flags that are allowed to be modified by RTM_CHANGE. */ 181120492Sfjoe#define RTF_FMASK \ 182120492Sfjoe (RTF_PROTO1 | RTF_PROTO2 | RTF_PROTO3 | RTF_BLACKHOLE | \ 183120492Sfjoe RTF_REJECT | RTF_STATIC) 184120492Sfjoe 185120492Sfjoe/* 186120492Sfjoe * Routing statistics. 187120492Sfjoe */ 188120492Sfjoestruct rtstat { 189120492Sfjoe short rts_badredirect; /* bogus redirect calls */ 190120492Sfjoe short rts_dynamic; /* routes created by redirects */ 191120492Sfjoe short rts_newgateway; /* routes modified by redirects */ 192120492Sfjoe short rts_unreach; /* lookups which failed */ 193120492Sfjoe short rts_wildcard; /* lookups satisfied by a wildcard */ 194120492Sfjoe}; 195120492Sfjoe/* 196194638Sdelphij * Structures for routing messages. 197194638Sdelphij */ 198194638Sdelphijstruct rt_msghdr { 199194638Sdelphij u_short rtm_msglen; /* to skip over non-understood messages */ 200194638Sdelphij u_char rtm_version; /* future binary compatibility */ 201194638Sdelphij u_char rtm_type; /* message type */ 202194638Sdelphij u_short rtm_index; /* index for associated ifp */ 203194638Sdelphij int rtm_flags; /* flags, incl. kern & message, e.g. DONE */ 204194638Sdelphij int rtm_addrs; /* bitmask identifying sockaddrs in msg */ 205194638Sdelphij pid_t rtm_pid; /* identify sender */ 206194638Sdelphij int rtm_seq; /* for sender to identify action */ 207194638Sdelphij int rtm_errno; /* why failed */ 208194638Sdelphij int rtm_fmask; /* bitmask used in RTM_CHANGE message */ 209194638Sdelphij#define rtm_use rtm_fmask /* deprecated, use rtm_rmx->rmx_pksent */ 210194638Sdelphij u_long rtm_inits; /* which metrics we are initializing */ 211194638Sdelphij struct rt_metrics rtm_rmx; /* metrics themselves */ 212194638Sdelphij}; 213194638Sdelphij 214194638Sdelphij#define RTM_VERSION 5 /* Up the ante and ignore older versions */ 215194638Sdelphij 216194638Sdelphij/* 217194638Sdelphij * Message types. 218194638Sdelphij */ 219194638Sdelphij#define RTM_ADD 0x1 /* Add Route */ 220194638Sdelphij#define RTM_DELETE 0x2 /* Delete Route */ 221120492Sfjoe#define RTM_CHANGE 0x3 /* Change Metrics or flags */ 222120492Sfjoe#define RTM_GET 0x4 /* Report Metrics */ 223120492Sfjoe#define RTM_LOSING 0x5 /* Kernel Suspects Partitioning */ 224120492Sfjoe#define RTM_REDIRECT 0x6 /* Told to use different route */ 225120492Sfjoe#define RTM_MISS 0x7 /* Lookup failed on this address */ 226120492Sfjoe#define RTM_LOCK 0x8 /* fix specified metrics */ 227120492Sfjoe#define RTM_OLDADD 0x9 /* caused by SIOCADDRT */ 228120492Sfjoe#define RTM_OLDDEL 0xa /* caused by SIOCDELRT */ 229120492Sfjoe#define RTM_RESOLVE 0xb /* req to resolve dst to LL addr */ 230120492Sfjoe#define RTM_NEWADDR 0xc /* address being added to iface */ 231120492Sfjoe#define RTM_DELADDR 0xd /* address being removed from iface */ 232120492Sfjoe#define RTM_IFINFO 0xe /* iface going up/down etc. */ 233120492Sfjoe#define RTM_NEWMADDR 0xf /* mcast group membership being added to if */ 234120492Sfjoe#define RTM_DELMADDR 0x10 /* mcast group membership being deleted */ 235120492Sfjoe#define RTM_IFANNOUNCE 0x11 /* iface arrival/departure */ 236120492Sfjoe#define RTM_IEEE80211 0x12 /* IEEE80211 wireless event */ 237120492Sfjoe 238120492Sfjoe/* 239120492Sfjoe * Bitmask values for rtm_inits and rmx_locks. 240120492Sfjoe */ 241120492Sfjoe#define RTV_MTU 0x1 /* init or lock _mtu */ 242120492Sfjoe#define RTV_HOPCOUNT 0x2 /* init or lock _hopcount */ 243120492Sfjoe#define RTV_EXPIRE 0x4 /* init or lock _expire */ 244120492Sfjoe#define RTV_RPIPE 0x8 /* init or lock _recvpipe */ 245120492Sfjoe#define RTV_SPIPE 0x10 /* init or lock _sendpipe */ 246120492Sfjoe#define RTV_SSTHRESH 0x20 /* init or lock _ssthresh */ 247120492Sfjoe#define RTV_RTT 0x40 /* init or lock _rtt */ 248120492Sfjoe#define RTV_RTTVAR 0x80 /* init or lock _rttvar */ 249120492Sfjoe 250120492Sfjoe/* 251120492Sfjoe * Bitmask values for rtm_addrs. 252120492Sfjoe */ 253120492Sfjoe#define RTA_DST 0x1 /* destination sockaddr present */ 254120492Sfjoe#define RTA_GATEWAY 0x2 /* gateway sockaddr present */ 255120492Sfjoe#define RTA_NETMASK 0x4 /* netmask sockaddr present */ 256120492Sfjoe#define RTA_GENMASK 0x8 /* cloning mask sockaddr present */ 257120492Sfjoe#define RTA_IFP 0x10 /* interface name sockaddr present */ 258120492Sfjoe#define RTA_IFA 0x20 /* interface addr sockaddr present */ 259120492Sfjoe#define RTA_AUTHOR 0x40 /* sockaddr for author of redirect */ 260120492Sfjoe#define RTA_BRD 0x80 /* for NEWADDR, broadcast or p-p dest addr */ 261120492Sfjoe 262120492Sfjoe/* 263120492Sfjoe * Index offsets for sockaddr array for alternate internal encoding. 264120492Sfjoe */ 265120492Sfjoe#define RTAX_DST 0 /* destination sockaddr present */ 266120492Sfjoe#define RTAX_GATEWAY 1 /* gateway sockaddr present */ 267120492Sfjoe#define RTAX_NETMASK 2 /* netmask sockaddr present */ 268120492Sfjoe#define RTAX_GENMASK 3 /* cloning mask sockaddr present */ 269120492Sfjoe#define RTAX_IFP 4 /* interface name sockaddr present */ 270120492Sfjoe#define RTAX_IFA 5 /* interface addr sockaddr present */ 271120492Sfjoe#define RTAX_AUTHOR 6 /* sockaddr for author of redirect */ 272120492Sfjoe#define RTAX_BRD 7 /* for NEWADDR, broadcast or p-p dest addr */ 273120492Sfjoe#define RTAX_MAX 8 /* size of array to allocate */ 274120492Sfjoe 275120492Sfjoestruct rt_addrinfo { 276120492Sfjoe int rti_addrs; 277120492Sfjoe struct sockaddr *rti_info[RTAX_MAX]; 278120492Sfjoe int rti_flags; 279120492Sfjoe struct ifaddr *rti_ifa; 280120492Sfjoe struct ifnet *rti_ifp; 281120492Sfjoe}; 282120492Sfjoe 283120492Sfjoe/* 284120492Sfjoe * This macro returns the size of a struct sockaddr when passed 285120492Sfjoe * through a routing socket. Basically we round up sa_len to 286120492Sfjoe * a multiple of sizeof(long), with a minimum of sizeof(long). 287120492Sfjoe * The check for a NULL pointer is just a convenience, probably never used. 288120492Sfjoe * The case sa_len == 0 should only apply to empty structures. 289120492Sfjoe */ 290120492Sfjoe#define SA_SIZE(sa) \ 291120492Sfjoe ( (!(sa) || ((struct sockaddr *)(sa))->sa_len == 0) ? \ 292120492Sfjoe sizeof(long) : \ 293120492Sfjoe 1 + ( (((struct sockaddr *)(sa))->sa_len - 1) | (sizeof(long) - 1) ) ) 294120492Sfjoe 295120492Sfjoe#ifdef _KERNEL 296120492Sfjoe 297120492Sfjoe#define RT_LOCK_INIT(_rt) \ 298148717Sstefanf mtx_init(&(_rt)->rt_mtx, "rtentry", NULL, MTX_DEF | MTX_DUPOK) 299120492Sfjoe#define RT_LOCK(_rt) mtx_lock(&(_rt)->rt_mtx) 300120492Sfjoe#define RT_TRYLOCK(_rt) mtx_trylock(&(_rt)->rt_mtx) 301120492Sfjoe#define RT_UNLOCK(_rt) mtx_unlock(&(_rt)->rt_mtx) 302120492Sfjoe#define RT_LOCK_DESTROY(_rt) mtx_destroy(&(_rt)->rt_mtx) 303120492Sfjoe#define RT_LOCK_ASSERT(_rt) mtx_assert(&(_rt)->rt_mtx, MA_OWNED) 304194638Sdelphij 305194638Sdelphij#define RT_ADDREF(_rt) do { \ 306194638Sdelphij RT_LOCK_ASSERT(_rt); \ 307194638Sdelphij KASSERT((_rt)->rt_refcnt >= 0, \ 308194638Sdelphij ("negative refcnt %ld", (_rt)->rt_refcnt)); \ 309194638Sdelphij (_rt)->rt_refcnt++; \ 310194638Sdelphij} while (0) 311194638Sdelphij#define RT_REMREF(_rt) do { \ 312194638Sdelphij RT_LOCK_ASSERT(_rt); \ 313194638Sdelphij KASSERT((_rt)->rt_refcnt > 0, \ 314194638Sdelphij ("bogus refcnt %ld", (_rt)->rt_refcnt)); \ 315194638Sdelphij (_rt)->rt_refcnt--; \ 316194638Sdelphij} while (0) 317194638Sdelphij 318194638Sdelphij#define RTFREE_LOCKED(_rt) do { \ 319194638Sdelphij if ((_rt)->rt_refcnt <= 1) \ 320194638Sdelphij rtfree(_rt); \ 321237698Sgabor else { \ 322194638Sdelphij RT_REMREF(_rt); \ 323120492Sfjoe RT_UNLOCK(_rt); \ 324120492Sfjoe } \ 325120492Sfjoe /* guard against invalid refs */ \ 326120492Sfjoe _rt = 0; \ 327120492Sfjoe } while (0) 328120492Sfjoe#define RTFREE(_rt) do { \ 329120492Sfjoe RT_LOCK(_rt); \ 330120492Sfjoe RTFREE_LOCKED(_rt); \ 331120492Sfjoe } while (0) 332120492Sfjoe 333120492Sfjoeextern struct radix_node_head *rt_tables[RT_MAXFIBS][AF_MAX+1]; 334120492Sfjoe 335120492Sfjoestruct ifmultiaddr; 336120492Sfjoe 337120492Sfjoevoid rt_ieee80211msg(struct ifnet *, int, void *, size_t); 338120492Sfjoevoid rt_ifannouncemsg(struct ifnet *, int); 339237698Sgaborvoid rt_ifmsg(struct ifnet *); 340120492Sfjoevoid rt_missmsg(int, struct rt_addrinfo *, int, int); 341120492Sfjoevoid rt_newaddrmsg(int, struct ifaddr *, int, struct rtentry *); 342120492Sfjoevoid rt_newmaddrmsg(int, struct ifmultiaddr *); 343120492Sfjoeint rt_setgate(struct rtentry *, struct sockaddr *, struct sockaddr *); 344120492Sfjoe 345120492Sfjoe/* 346120492Sfjoe * Note the following locking behavior: 347120492Sfjoe * 348120492Sfjoe * rtalloc_ign() and rtalloc() return ro->ro_rt unlocked 349120492Sfjoe * 350120492Sfjoe * rtalloc1() returns a locked rtentry 351120492Sfjoe * 352120492Sfjoe * rtfree() and RTFREE_LOCKED() require a locked rtentry 353120492Sfjoe * 354120492Sfjoe * RTFREE() uses an unlocked entry. 355120492Sfjoe */ 356120492Sfjoe 357120492Sfjoeint rtexpunge(struct rtentry *); 358120492Sfjoevoid rtfree(struct rtentry *); 359120492Sfjoe 360120492Sfjoe/* XXX MRT COMPAT VERSIONS THAT SET UNIVERSE to 0 */ 361120492Sfjoe/* Thes are used by old code not yet converted to use multiple FIBS */ 362120492Sfjoeint rt_getifa(struct rt_addrinfo *); 363120492Sfjoevoid rtalloc_ign(struct route *ro, u_long ignflags); 364120492Sfjoevoid rtalloc(struct route *ro); /* XXX deprecated, use rtalloc_ign(ro, 0) */ 365120492Sfjoestruct rtentry *rtalloc1(struct sockaddr *, int, u_long); 366120492Sfjoeint rtinit(struct ifaddr *, int, int); 367120492Sfjoeint rtioctl(u_long, caddr_t); 368120492Sfjoevoid rtredirect(struct sockaddr *, struct sockaddr *, 369120492Sfjoe struct sockaddr *, int, struct sockaddr *); 370120492Sfjoeint rtrequest(int, struct sockaddr *, 371120492Sfjoe struct sockaddr *, struct sockaddr *, int, struct rtentry **); 372120492Sfjoeint rtrequest1(int, struct rt_addrinfo *, struct rtentry **); 373120492Sfjoeint rt_check(struct rtentry **, struct rtentry **, struct sockaddr *); 374120492Sfjoe 375120492Sfjoe/* defaults to "all" FIBs */ 376120492Sfjoeint rtinit_fib(struct ifaddr *, int, int); 377120492Sfjoe 378120492Sfjoe/* XXX MRT NEW VERSIONS THAT USE FIBs 379120492Sfjoe * For now the protocol indepedent versions are the same as the AF_INET ones 380120492Sfjoe * but this will change.. 381120492Sfjoe */ 382120492Sfjoeint rt_getifa_fib(struct rt_addrinfo *, u_int fibnum); 383120492Sfjoevoid rtalloc_ign_fib(struct route *ro, u_long ignflags, u_int fibnum); 384120492Sfjoevoid rtalloc_fib(struct route *ro, u_int fibnum); 385120492Sfjoestruct rtentry *rtalloc1_fib(struct sockaddr *, int, u_long, u_int); 386120492Sfjoeint rtioctl_fib(u_long, caddr_t, u_int); 387120492Sfjoevoid rtredirect_fib(struct sockaddr *, struct sockaddr *, 388120492Sfjoe struct sockaddr *, int, struct sockaddr *, u_int); 389120492Sfjoeint rtrequest_fib(int, struct sockaddr *, 390120492Sfjoe struct sockaddr *, struct sockaddr *, int, struct rtentry **, u_int); 391120492Sfjoeint rtrequest1_fib(int, struct rt_addrinfo *, struct rtentry **, u_int); 392120492Sfjoeint rt_check_fib(struct rtentry **, struct rtentry **, struct sockaddr *, u_int); 393120492Sfjoe 394120492Sfjoe#include <sys/eventhandler.h> 395120492Sfjoetypedef void (*rtevent_arp_update_fn)(void *, struct rtentry *, uint8_t *, struct sockaddr *); 396120492Sfjoetypedef void (*rtevent_redirect_fn)(void *, struct rtentry *, struct rtentry *, struct sockaddr *); 397120492SfjoeEVENTHANDLER_DECLARE(route_arp_update_event, rtevent_arp_update_fn); 398120492SfjoeEVENTHANDLER_DECLARE(route_redirect_event, rtevent_redirect_fn); 399120492Sfjoe#endif 400120492Sfjoe 401120492Sfjoe#endif 402120492Sfjoe