netlink_poli...t_policy_idx(9)
β¨ NAME β¨
netlink_policy_dump_get_policy_idx β bestie, this is literally how you retrieve a policy index π
(we're in the Kernel API Manual btw, and this whole page is about that one function, ok? π«Ά)
πΈ SYNOPSIS πΈ
int netlink_policy_dump_get_policy_idx (struct netlink_policy_dump_state
*state , const struct nla_policy *policy , unsigned int maxtype );
π ARGUMENTS π
stateβ the policy dump state, like the little notebook where everything's written down πpolicyβ the policy you're tryna find πmaxtypeβ the policy'smaxattr. yes that's its name. no we're not changing it π
β RETURN β
It hands you back the index of the given policy in the dump state. that's it, that's the gift π
π DESCRIPTION π
okay so picture this: you've added multiple policies, and now you gotta tell userspace which command has which policy β by index, iykyk. That's exactly when you call this. It's the "wait which one was that again" function, but make it kernel β¨
π NOTE π
β οΈ heads up bestie: this will WARN and return 0 if the policy isn't found. And if it's not found, that means it wasn't added in the first place β which would be an internal consistency bug. so yeah. not a cute look. π
π¦ SEE ALSO π¦
Kernel file ./net/netlink/policy.c plus the whole squad:
netlink_policy_dump_add_policy(9)netlink_policy_dump_loop(9)netlink_policy_dump_write_attr(9)netlink_policy_dump_write(9)netlink_policy_dump_free(9)
k bye ily, this page came from ./net/netlink, dated October 2026, and it lives in the Kernel API Manual β slay and goodbye ππ§ββοΈπΈ
π¦ 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