OpenBSD manual page server

Manual Page Search Parameters

GETRTABLE(2) System Calls Manual GETRTABLE(2)

getrtable, setrtableget and set the default routing table of the current process

#include <sys/types.h>
#include <sys/socket.h>

int
getrtable(void);

int
setrtable(int rtableid);

() and () manipulate the routing table and routing domain associated with the current process.

Only the superuser is allowed to change the process routing table if it is already set to a non-zero value.

getrtable() returns the routing table of the current process. Upon successful completion, setrtable() returns 0 if the call succeeds, -1 if it fails.

The call succeeds unless:

[]
The value of the rtableid argument is not a valid routing table.
[]
The user is not the superuser and the routing table of the calling process is already set to a non-zero value.

getsockopt(2), route(8)

The getrtable() and setrtable() system calls appeared in OpenBSD 4.8.

September 10, 2015 OpenBSD-6.3