RTABLE_WALK(9)

πŸ“¦ in nixpkgs unstable

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 and prt got set, call rtfree() 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 of rtableid and address family of af doesn'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
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms