__nla_validate(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ __nla_validate(9) ✨

okay bestie, so this one's from the Kernel API Manual and it's literally the vibe check for netlink attributes πŸ’… like, it looks at your whole little stream of attrs and goes "mm, is this valid tho?" no cap.


🌸 NAME 🌸

__nla_validate β€” Validate a stream of attributes


πŸŽ€ SYNOPSIS πŸŽ€

int __nla_validate (const struct nlattr *head , int len , int maxtype ,
       const struct nla_policy *policy , unsigned int validate , struct
       netlink_ext_ack *extack );

πŸ¦‹ ARGUMENTS πŸ¦‹

  • head β€” head of attribute stream. like, the very first attr, the main character πŸ‘‘
  • len β€” length of attribute stream. how much stream we're dealing with, fr fr
  • maxtype β€” maximum attribute type to be expected. the ceiling, the limit, the "don't even try it" πŸ’€
  • policy β€” validation policy. the rulebook bestie, the whole personality of what's allowed
  • validate β€” validation strictness. how picky are we feeling today 🎚️
  • extack β€” extended ACK report struct. where the receipts go if something's off 🧾

πŸ’– DESCRIPTION πŸ’–

So what it does: it validates all attributes in the specified attribute stream against the specified policy. every single one. she's thorough. ✨

Validation depends on the validate flags passed β€” see enum netlink_validation for more details on that. and see the documentation of struct nla_policy for more details too, iykyk πŸ“š

Returns 0 on success or a negative error code. slay when it's 0, sad girl hours when it's negative 😭

ngl, the flags really do change how strict she is, so don't just assume one setting fits everything β€” check enum netlink_validation okay? 🫢

🌈 SEE ALSO 🌈

Kernel file ./lib/nlattr.c and honestly the whole friend group:

nla_policy_len(9), __nla_parse(9), nla_find(9), nla_strscpy(9), nla_strdup(9), nla_memcpy(9), nla_memcmp(9), nla_strcmp(9), __nla_reserve(9), __nla_reserve_64bit(9), __nla_reserve_nohdr(9), nla_reserve(9), nla_reserve_64bit(9), nla_reserve_nohdr(9), __nla_put(9), __nla_put_64bit(9), __nla_put_nohdr(9), nla_put(9), nla_put_64bit(9), nla_put_nohdr(9), nla_append(9)


okay that's the whole page, no notes πŸ’… this gem lives under ./lib, in the October 2026 era, and it's brought to you by __nla_validate(9) β€” validate your attrs and stay iconic, bestie πŸŽ€πŸ’œ

πŸ“¦ where this page comes from