include/net/netfilter/nf_flow_table.h
Source file repositories/reference/linux-study-clean/include/net/netfilter/nf_flow_table.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/netfilter/nf_flow_table.h- Extension
.h- Size
- 11137 bytes
- Lines
- 429
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/in.hlinux/in6.hlinux/netdevice.hlinux/rhashtable-types.hlinux/rcupdate.hlinux/netfilter.hlinux/netfilter/nf_conntrack_tuple_common.hnet/flow_offload.hnet/dst.hlinux/if_pppox.hlinux/ppp_defs.h
Detected Declarations
struct nf_flowtablestruct nf_flow_rulestruct flow_offloadstruct nf_flow_keystruct nf_flow_matchstruct nf_flow_rulestruct nf_flowtable_typestruct nf_flowtablestruct flow_offload_tunnelstruct flow_offload_tuplestruct flow_offload_tuple_rhashstruct flow_offloadstruct nf_flow_routestruct nft_flowtablestruct nft_pktinfostruct flow_portsenum flow_offload_tuple_direnum nf_flowtable_flagsenum flow_offload_tuple_direnum flow_offload_xmit_typeenum nf_flow_flagsenum flow_offload_typefunction nf_flowtable_hw_offloadfunction nf_flow_timeout_deltafunction nf_flow_table_offload_add_cbfunction nf_flow_table_offload_del_cbfunction nf_flow_register_bpffunction __nf_flow_pppoe_protofunction nf_flow_pppoe_protofunction nf_flow_table_init_procfunction nf_flow_table_fini_proc
Annotated Snippet
struct nf_flow_key {
struct flow_dissector_key_meta meta;
struct flow_dissector_key_control control;
struct flow_dissector_key_control enc_control;
struct flow_dissector_key_basic basic;
struct flow_dissector_key_vlan vlan;
struct flow_dissector_key_vlan cvlan;
union {
struct flow_dissector_key_ipv4_addrs ipv4;
struct flow_dissector_key_ipv6_addrs ipv6;
};
struct flow_dissector_key_keyid enc_key_id;
union {
struct flow_dissector_key_ipv4_addrs enc_ipv4;
struct flow_dissector_key_ipv6_addrs enc_ipv6;
};
struct flow_dissector_key_tcp tcp;
struct flow_dissector_key_ports tp;
} __aligned(BITS_PER_LONG / 8); /* Ensure that we can do comparisons as longs. */
struct nf_flow_match {
struct flow_dissector dissector;
struct nf_flow_key key;
struct nf_flow_key mask;
};
struct nf_flow_rule {
struct nf_flow_match match;
struct flow_rule *rule;
};
struct nf_flowtable_type {
struct list_head list;
int family;
int (*init)(struct nf_flowtable *ft);
bool (*gc)(const struct flow_offload *flow);
int (*setup)(struct nf_flowtable *ft,
struct net_device *dev,
enum flow_block_command cmd);
int (*action)(struct net *net,
struct flow_offload *flow,
enum flow_offload_tuple_dir dir,
struct nf_flow_rule *flow_rule);
void (*free)(struct nf_flowtable *ft);
void (*get)(struct nf_flowtable *ft);
void (*put)(struct nf_flowtable *ft);
nf_hookfn *hook;
struct module *owner;
};
enum nf_flowtable_flags {
NF_FLOWTABLE_HW_OFFLOAD = 0x1, /* NFT_FLOWTABLE_HW_OFFLOAD */
NF_FLOWTABLE_COUNTER = 0x2, /* NFT_FLOWTABLE_COUNTER */
};
struct nf_flowtable {
unsigned int flags; /* readonly in datapath */
int priority; /* control path (padding hole) */
struct rhashtable rhashtable; /* datapath, read-mostly members come first */
struct list_head list; /* slowpath parts */
const struct nf_flowtable_type *type;
struct delayed_work gc_work;
struct flow_block flow_block;
struct rw_semaphore flow_block_lock; /* Guards flow_block */
possible_net_t net;
};
static inline bool nf_flowtable_hw_offload(struct nf_flowtable *flowtable)
{
return flowtable->flags & NF_FLOWTABLE_HW_OFFLOAD;
}
enum flow_offload_tuple_dir {
FLOW_OFFLOAD_DIR_ORIGINAL = IP_CT_DIR_ORIGINAL,
FLOW_OFFLOAD_DIR_REPLY = IP_CT_DIR_REPLY,
};
#define FLOW_OFFLOAD_DIR_MAX IP_CT_DIR_MAX
enum flow_offload_xmit_type {
FLOW_OFFLOAD_XMIT_UNSPEC = 0,
FLOW_OFFLOAD_XMIT_NEIGH,
FLOW_OFFLOAD_XMIT_XFRM,
FLOW_OFFLOAD_XMIT_DIRECT,
FLOW_OFFLOAD_XMIT_TC,
};
#define NF_FLOW_TABLE_ENCAP_MAX 2
struct flow_offload_tunnel {
Annotation
- Immediate include surface: `linux/in.h`, `linux/in6.h`, `linux/netdevice.h`, `linux/rhashtable-types.h`, `linux/rcupdate.h`, `linux/netfilter.h`, `linux/netfilter/nf_conntrack_tuple_common.h`, `net/flow_offload.h`.
- Detected declarations: `struct nf_flowtable`, `struct nf_flow_rule`, `struct flow_offload`, `struct nf_flow_key`, `struct nf_flow_match`, `struct nf_flow_rule`, `struct nf_flowtable_type`, `struct nf_flowtable`, `struct flow_offload_tunnel`, `struct flow_offload_tuple`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: source implementation candidate.
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.