SETFIB(2FREEBSD) - Linux man page online | System calls

Set the default FIB (routing table) for the calling process.

March 19, 2012
SETFIB(2) BSD System Calls Manual SETFIB(2)


setfib — set the default FIB (routing table) for the calling process


Standard C Library (libc, -lc)


#include <sys/socket.h> int setfib(int fib);


The setfib() system call sets the associated fib for all sockets opened subsequent to the call, to be that of the argument fib. The fib argument must be greater than or equal to 0 and less than the current system maximum which may be retrieved by the net.fibs sysctl. The system maximum is set in the kernel configuration file with options ROUTETABLES=N or in /boot/loader.conf with net.fibs="N" where N is an integer. This maximum is capped at 65536 due to the implementation storing the fib number in a 16-bit field in the mbuf(9) packet header, however it is not suggested that one use such a large number as memory is allocated for every FIB regardless of whether it is used, and there are places where all FIBs are iterated over. The default fib of the process will be applied to all protocol families that support multi‐ ple fibs, and ignored by those that do not. The default fib for a process may be overridden for a socket with the use of the SO_SETFIB socket option.


The setfib() function returns the value 0 if successful; otherwise the value -1 is returned and the global variable errno is set to indicate the error.


The setfib() system call will fail and no action will be taken and return EINVAL if the fib argument is greater than the current system maximum.


setfib(1), setsockopt(2)


The setfib() system call is a FreeBSD extension however similar extensions have been added to many other UNIX style kernels.


The setfib() function appeared in FreeBSD 7.1.
BSD March 19, 2012 BSD
This manual Reference Other manuals
setfib(2freebsd) referred by ng_netflow(4freebsd)
refer to getsockopt(2) | mbuf(9freebsd)
Download raw manual
Index BSD System Calls Manual (+360) BSD (+3984) № 2 (+877)
Go top