RTABLE_WALK(9)

NAME
rtable_walk - iterate over a routing table

SYNOPSIS
#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);

DESCRIPTION
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.

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

RETURN VALUES
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.

SEE ALSO
rtfree(9)