xref: /openbsd/share/man/man9/rtable_add.9 (revision cecf84d4)
1.\"     $OpenBSD: rtable_add.9,v 1.5 2014/03/26 13:57:54 mpi Exp $
2.\"
3.\" Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org>
4.\" All rights reserved.
5.\"
6.\" Permission to use, copy, modify, and distribute this software for any
7.\" purpose with or without fee is hereby granted, provided that the above
8.\" copyright notice and this permission notice appear in all copies.
9.\"
10.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17.\"
18.Dd $Mdocdate: March 26 2014 $
19.Dt RTABLE_ADD 9
20.Os
21.Sh NAME
22.Nm rtable_add ,
23.Nm rtable_exists ,
24.Nm rtable_get ,
25.Nm rtable_l2 ,
26.Nm rtable_l2set
27.Nd routing tables and routing domains interface
28.Sh SYNOPSIS
29.In net/route.h
30.Ft int
31.Fn rtable_add "u_int id"
32.Ft int
33.Fn rtable_exists "u_int id"
34.Ft struct radix_node_head *
35.Fn rtable_get "u_int id" "sa_family_t af"
36.Ft u_int
37.Fn rtable_l2 "u_int id"
38.Ft void
39.Fn rtable_l2set "u_int id" "u_int rdomain"
40.Sh DESCRIPTION
41Routing tables contain layer 2 and 3 forwarding information.
42Each address family in use will have its own routing table.
43Routing domains are a way of logically segmenting a router among multiple
44networks and may contain more than one routing table.
45.Bl -tag -width Ds
46.It Fn rtable_add "u_int id"
47Add routing table with ID of
48.Fa id
49to routing domain
50.Fa 0 .
51.It Fn rtable_exists "u_int id"
52Return
53.Fa 1
54if routing table with ID
55.Fa id
56exists,
57.Fa 0
58otherwise.
59.It Fn rtable_get "u_int id" "sa_family_t af"
60Return the root node for the family
61.Fa af
62of the routing table with ID of
63.Fa id
64if it exists,
65.Fa NULL
66otherwise.
67.It Fn rtable_l2 "u_int id"
68Get the routing domain of routing table with ID of
69.Fa id .
70.It Fn rtable_l2set "u_int id" "u_int rdomain"
71Place routing table with ID of
72.Fa id
73under the routing domain with ID of
74.Fa rdomain .
75.El
76.Sh CONTEXT
77.Fn rtable_add ,
78.Fn rtable_exists ,
79.Fn rtable_get ,
80.Fn rtable_l2 ,
81and
82.Fn task_l2set
83can be called during autoconf, from process context, or from interrupt context.
84.Sh RETURN VALUES
85.Fn rtable_add
86may fail with:
87.Pp
88.Bl -tag -width Er -compact
89.It Bq Er EEXIST
90A routing table with ID of
91.Fa id
92already exists.
93.It Bq Er ENOMEM
94Memory could not be allocated to extend the list of routing domains.
95.El
96.Sh SEE ALSO
97.Xr route 4 ,
98.Xr route 8
99