STRUCT NFT_CTX(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct nft_ctx(9) β€” nf_tables rule/set context πŸŽ€

okay bestie, so this is a page from the Kernel API Manual, and it's literally all about struct nft_ctx β€” the little context bundle that nf_tables carries around when it's doing rule/set stuff. it's giving "backstage pass for netfilter" and honestly? iconic. 🌸


✨ NAME ✨

struct nft_ctx β€” nf_tables rule/set context, no cap πŸ’–


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole struct, bestie, copied exactly so you don't have to squint at a weirdly rendered header file:

struct nft_ctx {
    struct net                      *net;
    struct nft_table                *table;
    struct nft_chain                *chain;
    const struct nlattr * const     *nla;
    u32 portid;
    u32 seq;
    u16 flags;
    u8 family;
    u8 level;
    bool report;
    unsigned long reg_inited[BITS_TO_LONGS( NFT_REG32_NUM)];
};

look at her. all those fields. main character energy fr fr πŸ‘‘


πŸŽ€ Members πŸŽ€

every single one, with zero skips, periodt:

  • net β€” the net namespace. that's her home turf 🌈
  • table β€” the table the chain is contained in, i.e. the table that lowkey holds everything πŸ’œ
  • chain β€” the chain the rule is contained in. the rule lives here, no cap 🫢
  • nla β€” netlink attributes ✨
  • portid β€” the netlink portID of the original message, so we know who sent it πŸ’Œ
  • seq β€” the netlink sequence number, for keeping track of the convo πŸ”₯
  • flags β€” modifiers to new request. little toggles, big vibes πŸŽ›οΈ
  • family β€” the protocol family 🌐
  • level β€” the depth of the chains, like how deep down the chain rabbit hole we are πŸ•³οΈ
  • report β€” notify via unicast netlink message. yes, she tells you things πŸ’¬
  • reg_inited β€” bitmap of initialised registers. which registers are awake and ready, basically ⭐

πŸ‘‘ SEE ALSO πŸ‘‘

so the Kernel file is ./include/net/netfilter/nf_tables.h β€” go read it, it's the whole squad:

  • struct nft_verdict(9)
  • struct nft_regs(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(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)

like, the entire friend group. go say hi πŸ§šπŸ’–


ngl bestie, this is kernel API territory β€” read it properly before you start poking at it, k? 🫢

and that's the page!! this one ships out of ./include/net/netfilter and it's dated October 2026, filed under struct nft_ctx(9) β€” mwah, slay, bye πŸ’…πŸ“

πŸ“¦ where this page comes from