STRUCT NFT_SET(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 the NFT_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 β€” true during ->walk in 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 (see enum 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