2 .\" Copyright 1996 Massachusetts Institute of Technology
4 .\" Permission to use, copy, modify, and distribute this software and
5 .\" its documentation for any purpose and without fee is hereby
6 .\" granted, provided that both the above copyright notice and this
7 .\" permission notice appear in all copies, that both the above
8 .\" copyright notice and this permission notice appear in all
9 .\" supporting documentation, and that the name of M.I.T. not be used
10 .\" in advertising or publicity pertaining to distribution of the
11 .\" software without specific, written prior permission. M.I.T. makes
12 .\" no representations about the suitability of this software for any
13 .\" purpose. It is provided "as is" without express or implied
16 .\" THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS
17 .\" ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE,
18 .\" INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 .\" MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
20 .\" SHALL M.I.T. BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 .\" SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 .\" LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 .\" USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 .\" ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
25 .\" OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
26 .\" OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29 .\" $FreeBSD: src/share/man/man9/rtalloc.9,v 1.8.2.4 2001/12/17 11:30:18 ru Exp $
38 .Nd look up a route in the kernel routing table
44 .Fn rtalloc "struct route *ro"
46 .Fn rtalloc_ign "struct route *ro" "u_long flags"
47 .Ft "struct rtentry *"
48 .Fn rtalloc1 "struct sockaddr *sa" "int report" "u_long flags"
50 The kernel uses a radix tree structure to manage routes for the
51 networking subsystem. The
53 family of routines is used by protocols to query this structure for a
54 route corresponding to a particular end-node address, and to cause
55 certain protocol\- and interface-specific actions to take place.
56 .\" XXX - -mdoc should contain a standard request for getting em and
59 When a route with the flag
63 is retrieved, and the action of those flags is not masked, the
65 facility automatically generates a new route using information in the
66 old route as a template, and in the case of
70 message to the appropriate interface-address route-management routine
71 .Pq Fn ifa->ifa_rtrequest .
73 routes are assumed to be managed by the protocol family and no
74 resolution requests are made, but all routes generated by the cloning
75 process retain a reference to the route from which they were
81 message is sent instead on the
83 socket interface, requesting that an external program resolve the
84 address in question and modify the route appropriately.
86 The default interface is
91 .Dq Li "struct route" ,
92 which is defined as follows:
93 .Bd -literal -offset indent
95 struct sockaddr ro_dst;
96 struct rtentry *ro_rt;
99 Thus, this function can only be used for address families which are
100 smaller than the default
101 .Dq Li "struct sockaddr" .
104 for the first time, callers should ensure that unused bits of the
105 structure are set to zero. On subsequent calls,
107 returns without performing a lookup if
111 flag is set in the route's
117 interface can be used when the default actions of
119 in the presence of the
123 flags are undesired. The
125 argument is the same as
127 but there is additionally a
129 argument, which lists the flags in the route which are to be
131 (ordinarily, one or both of
134 .Dv RTF_PRCLONING ) .
138 function is the most general form of
140 (and both of the other forms are implemented as calls to rtalloc1).
142 .Dq Li "struct route" ,
143 and is therefore suitable for address families which require more
144 space than is in a traditional
145 .Dq Li "struct sockaddr" .
147 .Dq Li "struct sockaddr *"
150 argument. The second argument,
154 requests are sent to the lower layers when an
158 route is cloned. Ordinarily a value of one should be passed, except
159 in the processing of those lower layers which use the cloning
163 is a set of flags to ignore, as in
170 functions do not return a value. The
172 function returns a pointer to a routing-table entry if it succeeds,
173 otherwise a null pointer. Lack of a route should in most cases be
184 facility first appeared in
186 although with much different internals. The
195 This manual page was written by
196 .An Garrett Wollman ,
197 as were the changes to implement