nft_data_init(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… nft_data_init β€” the kernel API manual, but make it make sense ✨

okay so bestie, welcome to the nft_data_init(9) page, straight out of the Kernel API Manual πŸŽ€. This is the little kernel function that takes your raw netlink attributes and turns them into actual, usable nf_tables data. It's giving "backend bestie doing the heavy lifting" energy fr fr. Let's get into it 🫢


✨ SYNOPSIS ✨

int nft_data_init (const struct nft_ctx *ctx , struct nft_data *data ,
struct nft_data_desc *desc , const struct nlattr *nla );

yeah that's the whole squad right there 😭 four args, one int return, no drama. Slay.


🌸 ARGUMENTS 🌸

  • ctx β€” the context of the expression that's using the data πŸ‘‘ like, whose data is this anyway
  • data β€” the destination struct nft_data πŸ’– this is where the parsed goodies land
  • desc β€” the data description, aka the receipts πŸ“
  • nla β€” the netlink attribute that's carrying the data πŸ¦‹

πŸ’œ DESCRIPTION πŸ’œ

So what does it actually do? It parses the netlink data attributes and initializes a struct nft_data for you ✨. The type and length of the data get returned in the data description β€” so desc is literally telling you what you just got, iykyk πŸ’….

And here's the cute part πŸŽ€: the caller can say "bestie, I only want data of type NFT_DATA_VALUE" by passing NULL for the ctx argument. That's it. That's the whole flex. No ctx, no other types, just pure NFT_DATA_VALUE energy ⭐.

ngl, passing NULL isn't a bug, it's a choice β€” you're lowkey gatekeeping which data types get through πŸ™ˆ

🌈 SEE ALSO 🌈

the whole friend group πŸ’– go check these out:

like, that's a lot of siblings but they all ate πŸ”₯


okay that's the whole page bestie, you're officially fluent in nft_data_init πŸ’…βœ¨. shoutout to ./net/netfilter for hosting this absolute icon, and to October 2026 for the timestamp πŸŽ€ β€” no cap, we love a documented kernel API. bye bestie, go parse some attributes πŸ¦‹πŸ’–

πŸ“¦ where this page comes from