1.\" $OpenBSD: rtable_add.9,v 1.8 2016/11/14 10:32:46 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: November 14 2016 $ 19.Dt RTABLE_ADD 9 20.Os 21.Sh NAME 22.Nm rtable_add , 23.Nm rtable_exists , 24.Nm rtable_loindex , 25.Nm rtable_l2 , 26.Nm rtable_l2set 27.Nd routing tables and routing domains interface 28.Sh SYNOPSIS 29.In net/rtable.h 30.Ft int 31.Fn rtable_add "unsigned int id" 32.Ft int 33.Fn rtable_exists "unsigned int id" 34.Ft unsigned int 35.Fn rtable_loindex "unsigned int id" 36.Ft unsigned int 37.Fn rtable_l2 "unsigned int id" 38.Ft void 39.Fn rtable_l2set "unsigned int id" "unsigned 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 "unsigned int id" 47Add routing table with ID of 48.Fa id 49to routing domain 50.Fa 0 . 51.It Fn rtable_exists "unsigned int id" 52Return 53.Fa 1 54if routing table with ID 55.Fa id 56exists, 57.Fa 0 58otherwise. 59.It Fn rtable_loindex "unsigned int id" 60Return the default 61.Xr lo 4 62interface index for the routing table with ID of 63.Fa id . 64.It Fn rtable_l2 "unsigned int id" 65Get the routing domain of routing table with ID of 66.Fa id . 67.It Fn rtable_l2set "unsigned int id" "unsigned int rdomain" 68Place routing table with ID of 69.Fa id 70under the routing domain with ID of 71.Fa rdomain . 72.El 73.Sh CONTEXT 74.Fn rtable_add , 75.Fn rtable_exists , 76.Fn rtable_loindex , 77.Fn rtable_l2 , 78and 79.Fn task_l2set 80can be called during autoconf, from process context, or from interrupt context. 81.Sh RETURN VALUES 82.Fn rtable_add 83may fail with: 84.Pp 85.Bl -tag -width Er -compact 86.It Bq Er EEXIST 87A routing table with ID of 88.Fa id 89already exists. 90.It Bq Er ENOMEM 91Memory could not be allocated to extend the list of routing domains. 92.El 93.Sh SEE ALSO 94.Xr lo 4 , 95.Xr route 4 , 96.Xr route 8 97