nft_parse_u32_check(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… nft_parse_u32_check β€” a.k.a. the Kernel API Manual page, bestie edition ✨

okay so real talk, we're in the kernel API manual today and this one is a little function that does a lot of vibe-checking. it grabs a u32 netlink attribute, makes sure it's not doing too much, and tucks it into a variable. iconic behaviour honestly πŸŽ€


🌸 NAME 🌸

nft_parse_u32_check β€” fetch a u32 attribute and check it against a maximum value. that's the whole gig, no cap 🫢


✨ SYNOPSIS ✨

int nft_parse_u32_check (const struct nlattr *attr , int max , u32 *dest );

like, three args, zero drama πŸ”₯


πŸ¦‹ ARGUMENTS πŸ¦‹

  • attr β€” the netlink attribute we're pulling the value out of. this is the source, the main character of the fetch πŸ’…
  • max β€” the maximum value that's allowed to be stored in dest. the ceiling, the limit, the "no ma'am" line πŸ‘‘
  • dest β€” pointer to the variable where the value lands. the destination, the final resting place, the humble little home for your u32 🏑

πŸ’– DESCRIPTION πŸ’–

so here's the tea: this function parses a given u32 netlink attribute, checks it, and stores it into a variable. parse β†’ check β†’ store, in that exact order, we love a pipeline 🌈

if the value goes over the maximum value, it returns -ERANGE β€” like, that's the error code, and it's literally telling you "range issue bestie, it's too much" πŸ’€

otherwise, a 0 gets returned and the attribute value is stored in the destination variable. success. slay. the value is home 🌸

no hidden tricks in here β€” that's genuinely the whole flow: -ERANGE if it's over max, 0 plus a stored value if it's not ✨

🧚 SEE ALSO 🧚

the kernel file ./net/netfilter/nf_tables_api.c, plus the whole friend group:

go say hi to them, they're all in the same file iykyk πŸ¦‹


and that's the page!! source lives at ./net/netfilter, dated October 2026 β€” mwah, go forth and check your ranges responsibly πŸ’œπŸŽ€πŸ«Ά

πŸ“¦ where this page comes from