OpenBSD manual page server

Manual Page Search Parameters

RTABLE_WALK(9) Kernel Developer's Manual RTABLE_WALK(9)

rtable_walkiterate over a routing table

#include <net/rtable.h>

int
rtable_walk(unsigned int rtableid, sa_family_t af, struct rtentry **prt, int (*func)(struct rtentry *, void *, unsigned int), void *arg);

The rtable_walk() function iterates over the routing table rtableid and applies func to all entries of address family af.

The iteration is interrupted as soon as func returns a non-zero value. If prt is not NULL when the iteration is interrupted, it is set to the current routing entry. In that case rtfree() must be called on the routing entry pointed to by prt.

rtable_walk() can be called during autoconf or from process context.

rtable_walk() returns any non-zero value returned by func. It may also fail with:

[EAFNOSUPPORT]
A routing table with ID of rtableid and address family of af doesn't exist.

rtfree(9)

July 12, 2019 OpenBSD-current