netlink_poli...p_add_policy(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– NAME πŸ’–

netlink_policy_dump_add_policy β€” bestie, this is the one that adds a policy to the dump ✨

okay so real quick, this whole page lives in the Kernel API Manual and it's literally about one function, netlink_policy_dump_add_policy, so let's get into it 🫢


🌸 SYNOPSIS 🌸

int netlink_policy_dump_add_policy (struct netlink_policy_dump_state
**pstate , const struct nla_policy *policy , unsigned int maxtype );

yes the signature is iconic, no we're not changing a single character of it πŸ’…


πŸŽ€ ARGUMENTS πŸŽ€

  • pstate β€” the state you're adding to, bestie. heads up: it may be reallocated, and it must be NULL the first time β€” like, literally NULL, not "kinda empty", NULL NULL πŸ™ˆ
  • policy β€” the brand new policy you're adding to the dump ✨ main character energy fr
  • maxtype β€” the new policy's max attr type, aka the ceiling, the limit, the maxtype of the situation πŸ‘‘

⭐ RETURN ⭐

0 on success πŸŽ‰ β€” and a negative error code otherwise 😭 (so like, if you see a negative number, that's the vibe check failing ngl).


πŸ¦‹ DESCRIPTION πŸ¦‹

Call this bad boy to allocate a policy dump state and to add policies to it. two jobs, one function, we love a multitasker πŸ’…

And the important bit: this should be called from the dump start callback ⭐ like that's the spot, that's where it goes, no cap.


πŸ’€ NOTE πŸ’€

on failures, any previously allocated state is freed 😭 so like, no leaks, but also no leftovers β€” it cleans up after itself. periodt.

🌈 SEE ALSO 🌈

the whole little friend group, obsessed honestly πŸ§šβ€β™€οΈ


and that's the page!! shoutout to ./net/netlink for hosting this one, and to October 2026 for the timestamp β€” catch you in the next dump, bestie πŸ’œπŸŽ€βœ¨

πŸ“¦ where this page comes from