xref: /openbsd/lib/libc/sys/getrtable.2 (revision 91f110e0)
1.\" $OpenBSD: getrtable.2,v 1.3 2014/02/26 20:58:42 claudio Exp $
2.\"
3.\" Copyright (c) 2009 Reyk Floeter <reyk@openbsd.org>
4.\"
5.\" Permission to use, copy, modify, and distribute this software for any
6.\" purpose with or without fee is hereby granted, provided that the above
7.\" copyright notice and this permission notice appear in all copies.
8.\"
9.\" THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10.\" WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11.\" MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12.\" ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13.\" WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14.\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15.\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16.\"
17.Dd $Mdocdate: February 26 2014 $
18.Dt GETRTABLE 2
19.Os
20.Sh NAME
21.Nm getrtable ,
22.Nm setrtable
23.Nd get and set the default routing table of the current process
24.Sh SYNOPSIS
25.Fd #include <sys/types.h>
26.Fd #include <sys/socket.h>
27.Ft int
28.Fn getrtable "void"
29.Ft int
30.Fn setrtable "int rtableid"
31.Sh DESCRIPTION
32.Fn getrtable
33and
34.Fn setrtable
35manipulate the routing table and routing domain associated with the current
36process.
37.Pp
38Only the superuser is allowed to change the process routing table if
39it is already set to a non-zero value.
40.Sh RETURN VALUES
41.Fn getrtable
42returns the routing table of the current process.
43Upon successful completion,
44.Fn setrtable
45returns 0 if the call succeeds, \-1 if it fails.
46.Sh ERRORS
47The call succeeds unless:
48.Bl -tag -width Er
49.It Bq Er EINVAL
50The value of the
51.Fa rtableid
52argument is not a valid routing table.
53.It Bq Er EPERM
54The user is not the superuser and the routing table of the
55calling process is already set to a non-zero value.
56.El
57.Sh SEE ALSO
58.Xr getsockopt 2 ,
59.Xr route 8
60.Sh HISTORY
61The
62.Fn getrtable
63and
64.Fn setrtable
65system calls appeared in
66.Ox 4.8 .
67