RTABLE_WALK(9)
okay so bestie, welcome to rtable_walk(9) π
this is the page for iterating over a routing table, and it's honestly kind of iconic. let's get into it π«Ά
πΈ 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 π
okay so rtable_walk() iterates over the routing table rtableid and applies func to all entries of address family af. no cap, every single one that matches.
The iteration is interrupted as soon as func returns a non-zero value. periodt.
If prt is not NULL when the iteration is interrupted, it is set to the current routing entry. and bestie, listen: in that case rtfree() must be called on the routing entry pointed to by prt. like, required. don't skip it π
β οΈ if you get an interrupted iteration andprtgot set, callrtfree()on the entry it points to. that's the rule π
π§ CONTEXT π§
rtable_walk() can be called during autoconf or from process context. yep, both vibes. β¨
π₯ RETURN VALUES π₯
rtable_walk() returns any non-zero value returned by func. it may also fail with:
[EAFNOSUPPORT]β a routing table with ID ofrtableidand address family ofafdoesn't exist.
π SEE ALSO π
that's the whole page, bestie π sign-off time: this is from Debian, dated July 12, 2019, and the page is RTABLE_WALK(9) π slay.
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2019 Martin Pieuchot <mpi@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms