RT_SETGATE(9)
okay bestie, welcome to RT_SETGATE(9) from the Kernel Developer's Manual β yes, that's the manual name, and we're folding it in right here because we're cozy like that π
π NAME π
rt_setgate, rtredirect, rtdeletemsg β kernel routing interface. That's the trio, bestie. Iconic behavior only.
β¨ SYNOPSIS β¨
#include <net/route.h>
int
rt_setgate(struct rtentry *rt, struct sockaddr *gate, u_int tableid);
void
rtredirect(struct sockaddr *dst, struct sockaddr *gateway,
struct sockaddr *src, struct rtentry **rtp, unsigned int rdomain);
int
rtdeletemsg(struct rtentry *rt, struct ifnet *ifp, u_int tableid);
π£οΈ DESCRIPTION π£οΈ
Routing entries describe the routes to be taken by packets in a router. That's the whole vibe of this page, fr fr.
π rt_setgate(struct rtentry *rt, struct sockaddr *gate, u_int tableid) π
Set the address of the gateway for routes described by rt to gate. If memory has to be allocated to hold the gateway address, then the address for which rt describes routes will be copied from gate. No cap, that's literally the assignment.
π¦ rtredirect(struct sockaddr *dst, struct sockaddr *gateway, struct sockaddr *src, struct rtentry **rtp, unsigned int rdomain) π¦
Redirect routes to dst through gateway, such as in response to an ICMP redirect message. src should be the address from which the redirect message was received. If rtp is not NULL, it will be populated by the routing entry corresponding to dst. Slay, that's the whole redirect moment.
π rtdeletemsg(struct rtentry *rt, struct ifnet *ifp, u_int tableid) π
Delete routing table entry rt from table tableid and forward a notification message to all AF_ROUTE sockets. It's giving cleanup era, and honestly? Obsessed.
π¨ RETURN VALUES π¨
rt_setgate() may fail with:
[ENOBUFS]β memory could not be allocated for the gateway. Budget said no π
rtdeletemsg() may fail with:
[EAFNOSUPPORT]β the protocol used byrtis not supported by table with IDtableid.[ESRCH]β no routing entry forrtcould be found.[ESRCH]βrtis a multipath routing entry that conflicts with an existing one.
bestie, yes, [ESRCH] shows up twice on purpose. Do not come for me β that's literally what the page says π
π SEE ALSO π
go read these next, bestie: route(4), route(8), rt_timer_add(9), rtable_add(9), rtlabel_id2name(9), rtrequest(9) π«Ά
this page is from Debian, dated January 11, 2017 β mwah π stay routed, bestie ππ
π¦ where this page comes from
- nixpkgs unstable: cvs-export
- Copyright (c) 2011 Bret S. Lambert <blambert@openbsd.org>
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms