include/net/netfilter/nf_tables.h
Source file repositories/reference/linux-study-clean/include/net/netfilter/nf_tables.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/netfilter/nf_tables.h- Extension
.h- Size
- 55039 bytes
- Lines
- 1971
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: implementation source
- Status
- source implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hlinux/list.hlinux/netfilter.hlinux/netfilter/nfnetlink.hlinux/netfilter/nf_tables.hlinux/u64_stats_sync.hlinux/rhashtable.hnet/netfilter/nf_flow_table.hnet/netlink.hnet/flow_offload.hnet/netns/generic.h
Detected Declarations
struct modulestruct nft_pktinfostruct nft_verdictstruct nft_datastruct nft_regsstruct nft_ctxstruct nft_data_descstruct nft_userdatastruct nft_elem_privstruct nft_set_elemstruct nft_setstruct nft_set_iterstruct nft_set_descstruct nft_set_estimatestruct nft_exprstruct nft_expr_infostruct nft_set_extstruct nft_set_opsstruct nft_set_typestruct nft_set_elem_exprstruct nft_setstruct nft_set_bindingstruct nft_set_ext_typestruct nft_set_ext_tmplstruct nft_set_extstruct nft_timeoutstruct nft_expr_opsstruct nft_expr_typestruct nft_flow_rulestruct nft_offload_ctxstruct nft_expr_opsstruct nft_rulestruct nft_rule_dpstruct nft_rule_dp_laststruct nft_rule_blobstruct nft_chain_validate_statestruct nft_chainstruct nft_chain_typestruct nft_statsstruct nft_hookstruct nft_base_chainstruct nft_tablestruct nft_object_hash_keystruct nft_objectstruct nft_object_typestruct nft_object_opsstruct nft_flowtablestruct nft_traceinfo
Annotated Snippet
struct nft_pktinfo {
struct sk_buff *skb;
const struct nf_hook_state *state;
u8 flags;
u8 tprot;
__be16 ethertype;
u16 fragoff;
u16 nhoff;
u16 thoff;
u16 inneroff;
};
static inline struct sock *nft_sk(const struct nft_pktinfo *pkt)
{
return pkt->state->sk;
}
static inline unsigned int nft_thoff(const struct nft_pktinfo *pkt)
{
return pkt->thoff;
}
static inline struct net *nft_net(const struct nft_pktinfo *pkt)
{
return pkt->state->net;
}
static inline unsigned int nft_hook(const struct nft_pktinfo *pkt)
{
return pkt->state->hook;
}
static inline u8 nft_pf(const struct nft_pktinfo *pkt)
{
return pkt->state->pf;
}
static inline const struct net_device *nft_in(const struct nft_pktinfo *pkt)
{
return pkt->state->in;
}
static inline const struct net_device *nft_out(const struct nft_pktinfo *pkt)
{
return pkt->state->out;
}
static inline void nft_set_pktinfo(struct nft_pktinfo *pkt,
struct sk_buff *skb,
const struct nf_hook_state *state)
{
pkt->skb = skb;
pkt->state = state;
}
static inline void nft_set_pktinfo_unspec(struct nft_pktinfo *pkt)
{
pkt->flags = 0;
pkt->tprot = 0;
pkt->ethertype = pkt->skb->protocol;
pkt->nhoff = 0;
pkt->thoff = 0;
pkt->fragoff = 0;
}
/**
* struct nft_verdict - nf_tables verdict
*
* @code: nf_tables/netfilter verdict code
* @chain: destination chain for NFT_JUMP/NFT_GOTO
*/
struct nft_verdict {
u32 code;
struct nft_chain *chain;
};
struct nft_data {
union {
u32 data[4];
struct nft_verdict verdict;
};
} __attribute__((aligned(__alignof__(u64))));
#define NFT_REG32_NUM 20
/**
* struct nft_regs - nf_tables register set
*
* @data: data registers
* @verdict: verdict register
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/list.h`, `linux/netfilter.h`, `linux/netfilter/nfnetlink.h`, `linux/netfilter/nf_tables.h`, `linux/u64_stats_sync.h`, `linux/rhashtable.h`, `net/netfilter/nf_flow_table.h`.
- Detected declarations: `struct module`, `struct nft_pktinfo`, `struct nft_verdict`, `struct nft_data`, `struct nft_regs`, `struct nft_ctx`, `struct nft_data_desc`, `struct nft_userdata`, `struct nft_elem_priv`, `struct nft_set_elem`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.