rtnl_get_net_ns_capable(9)
π rtnl_get_net_ns_capable(9) π
okay bestie, so this is a page from the Kernel API Manual (yes, the actual kernel, not your group chat) and it's about rtnl_get_net_ns_capable β a lil function with a big job. it's short, it's sweet, and it literally gatekeeps network namespaces. let's get into it π
β¨ NAME β¨
rtnl_get_net_ns_capable β get netns if sufficiently privileged.
like, it hands you the netns only if you're that girl (privileged enough). no permission? no namespace. periodt π
πΈ SYNOPSIS πΈ
struct net * rtnl_get_net_ns_capable (struct sock *sk , int netnsid );
yep, that's the whole signature. two args in, a struct net * out. slay β¨
π¦ ARGUMENTS π¦
skβ the netlink socket. this is your main character socket, the one going "hey, can i have that namespace please" π₯Ίnetnsidβ the network namespace identifier. it's literally the ID number of the netns you're asking about, iykyk π’
π DESCRIPTION π
so what does it actually do? it returns the network namespace identified by netnsid on success π β that's it, that's the win.
and on failure? it returns an error pointer π not NULL, not a vibey empty struct, an error pointer. so pls, check it properly before you go dereferencing, bestie. no cap, do the IS_ERR() check or it's giving undefined chaos π
that's genuinely the whole description. short and iconic. the function ate and left no crumbs π«Ά
π SEE ALSO π
what else is in the ./net/core/rtnetlink.c circle? the whole friend group fr fr:
rtnl_nets_add(9)rtnl_unregister(9)rtnl_unregister_all(9)__rtnl_register_many(9)rtnl_link_register(9)rtnl_link_unregister(9)rtnl_af_register(9)rtnl_af_unregister(9)ndo_dflt_fdb_dump(9)
go read those too, they're all living in the Kernel file ./net/core/rtnetlink.c π§ββοΈ
π cute lil sign-off: this page is brought to you by the ./net/core girlies, dated October 2026, straight out of the Kernel API Manual. mwah, go write some royal netlink code ππ
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms