netlink_poli...p_add_policy(9)
π 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 beNULLthe first time β like, literallyNULL, not "kinda empty",NULLNULLπpolicyβ the brand new policy you're adding to the dump β¨ main character energy frmaxtypeβ the new policy's max attr type, aka the ceiling, the limit, themaxtypeof 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 π
- Kernel file
./net/netlink/policy.cβ go read the source, iykyk π netlink_policy_dump_get_policy_idx(9)netlink_policy_dump_loop(9)netlink_policy_dump_write_attr(9)netlink_policy_dump_write(9)netlink_policy_dump_free(9)
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
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms