STRUCT NETLINK_EXT_ACK(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

okay so picture this: it's a page from the Kernel API Manual, and we're talking about struct netlink_ext_ack β€” the netlink extended ACK report struct. yes. that one. she's lowkey the reason your netlink errors actually tell you what went wrong instead of just vibing with a vague -EINVAL. iconic behaviour honestly πŸŽ€


✨ SYNOPSIS ✨

struct netlink_ext_ack {
    const char *_msg;
    const struct nlattr *bad_attr;
    const struct nla_policy *policy;
    const struct nlattr *miss_nest;
    u16 miss_type;
    u8 cookie[NETLINK_MAX_COOKIE_LEN];
    u8 cookie_len;
    char _msg_buf[NETLINK_MAX_FMTMSG_LEN];
 };

that's her. that's the whole struct. copy it exactly, don't be cute with it 🌸


🫢 Members 🫢

okay so let's meet the cast, one field at a time πŸ’–

  • _msg β€” the message string to report. ⚠️ but bestie listen: do NOT access this directly β€” use NL_SET_ERR_MSG instead. she's not for touching with your bare hands, she's for going through the proper channels, iykyk πŸ’…
  • bad_attr β€” the attribute that has the error. the actual culprit. we found her πŸ”₯
  • policy β€” the policy for a bad attribute. so like, the rules that the bad attribute was supposed to be following πŸ“‹
  • miss_nest β€” the nest that's missing an attribute. and fr fr, it's NULL if it's the top level attr that's missing β€” so check that before you go dereferencing, no cap πŸ™ˆ
  • miss_type β€” the attribute type which was missing. the one that ghosted us πŸ‘»
  • cookie β€” cookie data to return to userspace. and yes, this one's for success πŸͺ✨ (cookies on a success?? we love a positive reinforcement moment)
  • cookie_len β€” the actual cookie data length. the real number, not the imaginary one ⭐
  • _msg_buf β€” output buffer for formatted message strings. and again bestie, don't access directly β€” use NL_SET_ERR_MSG_FMT. same energy as _msg, different macro. don't mix them up 😭
genuinely: the two "don't access directly" fields are the whole vibe check of this struct. use the macros. the macros are your besties. 🫢

πŸ‘‘ SEE ALSO πŸ‘‘

go read the source, she's right there and she's required reading:

  • Kernel file ./include/linux/netlink.h πŸ“–

and that's the tea πŸ“ this page lives in ./include/linux, dated October 2026, and it's literally titled struct netlink_ext_ack(9) β€” slay, bye, go set your error messages properly πŸ’œπŸ§š

πŸ“¦ where this page comes from