nft_parse_u32_check(9)
π
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 indest. 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:-ERANGEif it's overmax,0plus a stored value if it's not β¨
π§ SEE ALSO π§
the kernel file ./net/netfilter/nf_tables_api.c, plus the whole friend group:
nft_register_expr(9)nft_unregister_expr(9)nft_data_hold(9)nft_register_obj(9)nft_unregister_obj(9)nft_dump_register(9)nft_data_init(9)nft_data_release(9)
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
- 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