nla_parse(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… nla_parse β€” NAME πŸ’…

okay so bestie, welcome to nla_parse(9), straight out of the Kernel API Manual ✨ β€” it parses a stream of attributes into a tb buffer, and honestly? it's giving main character energy in the netlink world πŸŽ€


✨ SYNOPSIS ✨

int nla_parse (struct nlattr **tb , int maxtype , const struct nlattr *head , int len , const struct nla_policy *policy , struct netlink_ext_ack *extack );

🫢 ARGUMENTS 🫢

  • tb β€” the destination array, and it needs maxtype+1 elements in it. like, do the math first bestie, no cap πŸ’€
  • maxtype β€” the maximum attribute type you're expecting. anything bigger is not invited to the party πŸ™ˆ
  • head β€” the head of the attribute stream. the beginning. the origin story ✨
  • len β€” the length of the attribute stream 🌸
  • policy β€” the validation policy. yes you do have to bring one πŸŽ€
  • extack β€” the extended ACK pointer πŸ’Œ

🌸 DESCRIPTION 🌸

so what it does is parse a stream of attributes and stash a pointer to each one in the tb array β€” and you get at each of those pointers via the attribute type πŸ¦‹ iykyk.

attributes whose type exceeds maxtype get rejected, periodt πŸ’…. policy must be specified (not optional, we don't do optional here), and the attributes get validated in the strictest way possible πŸ”₯. she's thorough. she's not playing around.


⭐ RETURN ⭐

0 on success, or a negative error code 😭 β€” so yeah, always check it, bestie, fr fr.


πŸ‘‘ SEE ALSO πŸ‘‘

the whole extended friend group 🫢 first up, the kernel file itself: ./include/net/netlink.h, plus struct nla_policy(9), struct nl_info(9), and enum netlink_validation(9) ⭐

the parsing & validation girlies πŸ’œ

the nlmsg size & data crew πŸ“

the nlmsg putting / building / sending squad πŸŽ€

the nla core icons πŸ‘‘

the nla_put_* besties (yes, all of them, we don't skip) πŸ’–

the nla_get_* besties (also all of them, obviously) πŸ“

and the rest of the group chat, ily all πŸ’œπŸ§š


ok that's literally the whole squad, nobody got left on read πŸ’€βœ¨

and that's the page, bestie πŸŽ€ this lil love letter lives in ./include/net and it's dated October 2026 β€” go parse some attributes, you're gonna slay πŸ’…πŸ¦‹

πŸ“¦ where this page comes from