xref: /openbsd/share/man/man9/route.9 (revision e3fc592a)
1*e3fc592aSrzalamena.\"     $OpenBSD: route.9,v 1.17 2017/01/11 15:09:52 rzalamena Exp $
2fb4aa834Sblambert.\"
3fb4aa834Sblambert.\" Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org>
4fb4aa834Sblambert.\" All rights reserved.
5fb4aa834Sblambert.\"
6fb4aa834Sblambert.\" Permission to use, copy, modify, and distribute this software for any
7fb4aa834Sblambert.\" purpose with or without fee is hereby granted, provided that the above
8fb4aa834Sblambert.\" copyright notice and this permission notice appear in all copies.
9fb4aa834Sblambert.\"
10fb4aa834Sblambert.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11fb4aa834Sblambert.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12fb4aa834Sblambert.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13fb4aa834Sblambert.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14fb4aa834Sblambert.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15fb4aa834Sblambert.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16fb4aa834Sblambert.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17fb4aa834Sblambert.\"
18*e3fc592aSrzalamena.Dd $Mdocdate: January 11 2017 $
19*e3fc592aSrzalamena.Dt RT_SETGATE 9
20fb4aa834Sblambert.Os
21fb4aa834Sblambert.Sh NAME
2233378d91Sjmc.Nm rt_setgate ,
2333378d91Sjmc.Nm rtredirect ,
2433378d91Sjmc.Nm rtdeletemsg
25fb4aa834Sblambert.Nd kernel routing interface
26fb4aa834Sblambert.Sh SYNOPSIS
27dddd2645Sschwarze.In net/route.h
28fb4aa834Sblambert.Ft int
29*e3fc592aSrzalamena.Fn rt_setgate "struct rtentry *rt" "struct sockaddr *gate" "u_int tableid"
30fb4aa834Sblambert.Ft void
31fb4aa834Sblambert.Fn rtredirect "struct sockaddr *dst" "struct sockaddr *gateway" \
32*e3fc592aSrzalamena"struct sockaddr *src" "struct rtentry **rtp" "unsigned int rdomain"
33fb4aa834Sblambert.Ft int
34*e3fc592aSrzalamena.Fn rtdeletemsg "struct rtentry *rt" "struct ifnet *ifp" "u_int tableid"
35fb4aa834Sblambert.Sh DESCRIPTION
36fb4aa834SblambertRouting entries describe the routes to be taken by packets in a router.
37fb4aa834Sblambert.Bl -tag -width Ds
38*e3fc592aSrzalamena.It Fn rt_setgate "struct rtentry *rt" "struct sockaddr *gate" "u_int tableid"
39fb4aa834SblambertSet the address of the gateway for routes described by
40*e3fc592aSrzalamena.Fa rt
41fb4aa834Sblambertto
42*e3fc592aSrzalamena.Fa gate .
43fb4aa834SblambertIf memory must be allocated to hold the gateway address,
44fb4aa834Sblambertthe address for which
45*e3fc592aSrzalamena.Fa rt
46fb4aa834Sblambertdescribes routes will be copied from
47*e3fc592aSrzalamena.Fa gate .
48fb4aa834Sblambert.It Fn rtredirect "struct sockaddr *dst" "struct sockaddr *gateway" \
49*e3fc592aSrzalamena"struct sockaddr *src" "struct rtentry **rtp" "unsigned int rdomain"
50fb4aa834SblambertRedirect routes to
51fb4aa834Sblambert.Fa dst
52fb4aa834Sblambertthrough
53fb4aa834Sblambert.Fa gateway ,
54fb4aa834Sblambertsuch as in response to an ICMP redirect message.
55fb4aa834Sblambert.Fa src
56fb4aa834Sblambertshould be the address from which the redirect message was received.
57fb4aa834SblambertIf
58fb4aa834Sblambert.Fa rtp
59fb4aa834Sblambertis not NULL,
60fb4aa834Sblambertit will be populated by the routing entry corresponding to
61fb4aa834Sblambert.Fa dst .
62*e3fc592aSrzalamena.It Fn rtdeletemsg "struct rtentry *rt" "struct ifnet *ifp" "u_int tableid"
63fb4aa834SblambertDelete routing table entry
64fb4aa834Sblambert.Fa rt
65fb4aa834Sblambertfrom table
66fb4aa834Sblambert.Fa tableid
67fb4aa834Sblambertand forward a notification message to all
68fb4aa834Sblambert.Fa AF_ROUTE
69fb4aa834Sblambertsockets.
70fb4aa834Sblambert.El
71fb4aa834Sblambert.Sh RETURN VALUES
72fb4aa834Sblambert.Fn rt_setgate
735a0660dcSbluhmmay fail with:
745a0660dcSbluhm.Pp
755a0660dcSbluhm.Bl -tag -width Er -compact
765a0660dcSbluhm.It Bq Er ENOBUFS
775a0660dcSbluhmMemory could not be allocated for the gateway.
785a0660dcSbluhm.El
79fb4aa834Sblambert.Pp
80fb4aa834Sblambert.Fn rtdeletemsg
81fb4aa834Sblambertmay fail with:
82fb4aa834Sblambert.Pp
83fb4aa834Sblambert.Bl -tag -width Er -compact
84fb4aa834Sblambert.It Bq Er EAFNOSUPPORT
85fb4aa834SblambertThe protocol used by
86fb4aa834Sblambert.Fa rt
87fb4aa834Sblambertis not supported by table with ID
88fb4aa834Sblambert.Fa tableid .
89fb4aa834Sblambert.It Bq Er ESRCH
90fb4aa834SblambertNo routing entry for
91fb4aa834Sblambert.Fa rt
92fb4aa834Sblambertcould be found.
93fb4aa834Sblambert.It Bq Er ESRCH
94fb4aa834Sblambert.Fa rt
9571d9dc5bSmpiis a multipath routing entry that conflicts with an existing one.
96fb4aa834Sblambert.El
97fb4aa834Sblambert.Sh SEE ALSO
98fb4aa834Sblambert.Xr route 4 ,
99351af3c2Smpi.Xr route 8 ,
100351af3c2Smpi.Xr rt_timer_add 9 ,
101351af3c2Smpi.Xr rtable_add 9 ,
1029899df98Smpi.Xr rtlabel_id2name 9 ,
1039ab903caSbluhm.Xr rtrequest 9
104