netlink_poli...t_policy_idx(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ 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's maxattr. 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:


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