STRUCT RTNL_MSG_HANDLER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ struct rtnl_msg_handler(9) β€” like, the whole kernel API manual vibe πŸ¦‹

okay bestie, so this is struct rtnl_msg_handler(9) from the Kernel API Manual, and it's literally the lil registration table that tells rtnetlink "hey, when this kind of message shows up, run this handler." main character energy fr fr πŸ’…


✨ NAME ✨

struct rtnl_msg_handler β€” rtnetlink message type and handlers. that's it, that's the vibe πŸŽ€


🌸 SYNOPSIS 🌸

struct rtnl_msg_handler {
    struct module *owner;
    int protocol;
    int msgtype;
    rtnl_doit_func doit;
    rtnl_dumpit_func dumpit;
    int flags;
 };

like, look at her. six fields. not one wasted. she ate. πŸ”₯


πŸ‘‘ Members πŸ‘‘

okay so this is the part where we go field by field, and ngl every single one matters, so no skipping πŸ™ˆ

  • owner β€” NULL for built-in, THIS_MODULE for module. yes literally that. built-in stuff passes NULL, modules pass THIS_MODULE so the kernel knows who to blame (affectionately) πŸ’–
  • protocol β€” the Protocol family, or PF_UNSPEC. that's the whole story, no cap πŸ¦‹
  • msgtype β€” the rtnetlink message type. this is the key that decides which handler gets picked, iykyk ⭐
  • doit β€” Function pointer called for each request message. so every time a request comes in, this gets called. main character function pointer energy πŸ‘‘
  • dumpit β€” Function pointer called for each dump request (NLM_F_DUMP) message. notice the NLM_F_DUMP β€” that's the tell that this is the dump path, not the plain request path 🌈
  • dumpit ... no wait, flags β€” rtnl_link_flags to modify behaviour of doit/dumpit functions. cute lil behaviour knobs for the two function pointers above πŸŽ€
bestie reminder: owner is NULL for built-in and THIS_MODULE for module β€” get that backwards and things get weird. you've been warned πŸ’€

πŸ” SEE ALSO πŸ”

  • Kernel file ./include/net/rtnetlink.h
  • struct rtnl_newlink_params(9)
  • struct rtnl_link_ops(9)
  • struct rtnl_af_ops(9)

go read those too, they're all in the same friend group 🫢


okay that's the whole page!! source/version: this one lives under ./include/net and it's dated October 2026, filed under struct rtnl_msg_handler(9). slay, go register some handlers, mwah πŸ’œβœ¨

πŸ“¦ where this page comes from