STRUCT NFT_SET(9)
π
struct nft_set β nf_tables set instance π
okay so real talk, this is the struct nft_set page out of the Kernel API Manual, and like... it's genuinely iconic?? this whole page is one big flex about the little set object that nf_tables builds everything on top of. bestie, grab a strawberry drink π and let's get into it, no cap.
β¨ NAME β¨
struct nft_set β the nf_tables set instance π like, the actual thing, not the idea of the thing.
π¦ SYNOPSIS π¦
here's the whole vibe, character for character, do not touch:
struct nft_set {
struct list_head list;
struct list_head bindings;
refcount_t refs;
struct nft_table *table;
possible_net_t net;
char *name;
u64 handle;
u32 ktype;
u32 dtype;
u32 objtype;
u32 size;
u8 field_len[NFT_REG32_COUNT];
u8 field_count;
bool in_update_walk;
u32 use;
atomic_t nelems;
u32 ndeact;
u64 timeout;
u32 gc_int;
u16 policy;
u16 udlen;
unsigned char *udata;
struct list_head pending_update;
const struct nft_set_ops *ops;
u16 flags:13, dead:1, genmask:2;
u8 klen;
u8 dlen;
u8 num_exprs;
struct nft_expr *exprs[NFT_SET_EXPR_MAX];
struct list_head catchall_list;
unsigned char data[];
};
like... look at that. main character energy from top to bottom. π
πΈ Members πΈ
every single one, in order, bestie β nothing skipped, that's the rule:
listβ table set list node. it's literally the little handle that hooks this set into its table's list π«Άbindingsβ list of set bindings. the friend group of things attached to this set.refsβ internal refcounting for async set destruction π yes, it keeps score so the set can go away asynchronously without anyone crying.tableβ table this set belongs to. its home base.netβ netnamespace this set belongs to. which netns it reps.nameβ name of the set. its government name β¨handleβ unique handle of the set. the one-of-one ID.ktypeβ key type (numeric type defined by userspace, not used in the kernel). yeah, that's the actual context, don't @ me.dtypeβ data type (verdict or numeric type defined by userspace).objtypeβ object type (see theNFT_OBJECT_*definitions π).sizeβ maximum set size.field_lenβ length of each field in concatenation, bytes.field_countβ number of concatenated fields in element.in_update_walkβtrueduring->walkin transaction phase. it's giving "currently mid-walk."useβ number of rules references to this set.nelemsβ number of elements.ndeactβ number of deactivated elements queued for removal ποΈ queued up, not gone yet.timeoutβ default timeout value in jiffies.gc_intβ garbage collection interval in msecs. the cleanup schedule, lowkey vital.policyβ set parameterization (seeenum nft_set_policies).udlenβ user data length.udataβ user data.pending_updateβ list of pending update set element. the "on my way" list πopsβ set ops.flagsβ set flags.deadβ set will be freed, never cleared. like, that's not a mood, that's a one-way door πgenmaskβ generation mask.klenβ key length.dlenβ data length.num_exprsβ numbers of exprs.exprsβ stateful expression.catchall_listβ list of catch-all set element. catching everything, obviously.dataβ private set data.
π₯ SEE ALSO π₯
the whole extended universe, bestie β every single reference, and yes the kernel file goes first:
- Kernel file
./include/net/netfilter/nf_tables.h struct nft_verdict(9)struct nft_regs(9)struct nft_ctx(9)struct nft_userdata(9)struct nft_set_elem(9)enum nft_iter_type(9)struct nft_set_desc(9)enum nft_set_class(9)struct nft_set_estimate(9)struct nft_expr(9)struct nft_set_ops(9)struct nft_set_type(9)struct nft_set_binding(9)enum nft_set_extensions(9)struct nft_set_ext_type(9)struct nft_set_ext_tmpl(9)struct nft_set_ext(9)struct nft_expr_type(9)struct nft_expr_ops(9)struct nft_rule(9)struct nft_chain_validate_state(9)struct nft_chain(9)struct nft_chain_type(9)struct nft_base_chain(9)struct nft_table(9)struct nft_object_hash_key(9)struct nft_object(9)struct nft_object_type(9)struct nft_object_ops(9)struct nft_flowtable(9)struct nft_traceinfo(9)struct nft_trans(9)struct nft_trans_hook(9)struct nft_trans_binding(9)
ok that's the whole page!! every field accounted for, zero skips, we ate and left no crumbs π
and finally, the cute little sign-off where the boring footer used to live: this one comes from ./include/net/netfilter, stamped October 2026, and it's filed under struct nft_set(9) β slay, bye bestie ππ¦β¨
π¦ 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