RT_IFA_ADD(9)
π RT_IFA_ADD β the kernel developer's manual, bestie edition π
okay so you're reading RT_IFA_ADD(9), which is section 9 of the Kernel Developer's Manual β aka the deep lore, the kernel-dev-only zone, no cap. These four functions are literally the bouncer squad for routing entries: rt_ifa_add, rt_ifa_del, rt_ifa_addlocal, and rt_ifa_dellocal. Their whole job? Add or delete the routing entries associated with an address. Iconic behavior, honestly. π
β¨ NAME β¨
rt_ifa_add, rt_ifa_del, rt_ifa_addlocal, rt_ifa_dellocal β add or delete routing entries associated with an address π¦
π SYNOPSIS π
okay first, you gotta pull in the headers β all four of them, don't skip, they're the vibe check for your includes:
#include <sys/types.h>
#include <sys/socket.h>
#include <net/if.h>
#include <net/route.h>
then the functions themselves, in their full glory:
int
rt_ifa_add(struct ifaddr *ifa, int flags, struct sockaddr *dst,
unsigned int rdomain);
int
rt_ifa_del(struct ifaddr *ifa, int flags, struct sockaddr *dst,
unsigned int rdomain);
int
rt_ifa_addlocal(struct ifaddr *ifa);
int
rt_ifa_dellocal(struct ifaddr *ifa);
look at those signatures bestie, they're giving main character energy β¨
π§ DESCRIPTION π§
so basically these functions create and delete routing entries required by the network stack and managed by the kernel. that's the whole assignment, and they ate. π
rt_ifa_add()
Creates and associates a connected routing entry with ifa in the routing domain specified by rdomain. π«Ά
Now here's the part where you gotta pay attention, because there are two whole flavors of connected routing entry:
- The prefix vibe β Connected routing entries represent routes to prefixes, and should be created with
RTF_CLONINGinflagsand the address ofifaindst. - The point-to-point vibe β But for Point-to-Point interfaces, connected routing entries represent routes to hosts, and should be created with
RTF_HOSTinflagsand the destination address indst.
Either way, connected routing entries have a priority of RTP_CONNECTED. β
rt_ifa_del()
Removes the connected routing entry associated with ifa in the routing domain specified by rdomain. gone, deleted, blocked, unfollowed π
rt_ifa_addlocal()
Creates and associates a local routing entry with ifa. π
Local routing entries are used to not send packets destined to a local address on the wire, and instead redirect them to lo(4). literally "you're already home, why travel" energy. they have the lowest priority available, RTP_LOCAL, and contain a special flag, RTF_LOCAL, that can be checked to determine if the address is configured on the system. that flag is your iykyk detector fr fr
rt_ifa_dellocal()
Removes the local routing entry associated with ifa. bye bestie, the address is no longer configured on the system π
π CONTEXT π
rt_ifa_add(), rt_ifa_del(), rt_ifa_addlocal(), and rt_ifa_dellocal() can be called during autoconf, from process context, or from interrupt context. three whole situations and they're flexible in all of them, we love a versatile queen π
π RETURN VALUES π
rt_ifa_add(), rt_ifa_del(), rt_ifa_addlocal(), and rt_ifa_dellocal() will return 0 on success and the return value of rtrequest(9) otherwise. so 0 = slayed, anything else = go check what rtrequest(9) said π
π¦ SEE ALSO π¦
π okay that's the whole page, go forth and configure addresses responsibly, bestie
and finally, the cute little sign-off: this page came from Debian, dated February 13, 2019. periodt. πβ¨πΈ
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2014 Martin Pieuchot
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms