include/net/netfilter/nf_conntrack_tuple.h
Source file repositories/reference/linux-study-clean/include/net/netfilter/nf_conntrack_tuple.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/netfilter/nf_conntrack_tuple.h- Extension
.h- Size
- 4705 bytes
- Lines
- 191
- 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/netfilter.hlinux/netfilter/nf_conntrack_tuple_common.hlinux/list_nulls.h
Detected Declarations
struct nf_conntrack_manstruct nf_conntrack_tuplestruct nf_conntrack_tuple_maskstruct nf_conntrack_tuple_hashfunction nf_ct_dump_tuple_ipfunction nf_ct_dump_tuple_ipv6function nf_ct_dump_tuplefunction __nf_ct_tuple_src_equalfunction __nf_ct_tuple_dst_equalfunction nf_ct_tuple_equalfunction nf_ct_tuple_mask_equalfunction nf_ct_tuple_src_mask_cmpfunction nf_ct_tuple_mask_cmp
Annotated Snippet
struct nf_conntrack_man {
union nf_inet_addr u3;
union nf_conntrack_man_proto u;
/* Layer 3 protocol */
u_int16_t l3num;
};
/* This contains the information to distinguish a connection. */
struct nf_conntrack_tuple {
struct nf_conntrack_man src;
/* These are the parts of the tuple which are fixed. */
struct {
union nf_inet_addr u3;
union {
/* Add other protocols here. */
__be16 all;
struct {
__be16 port;
} tcp;
struct {
__be16 port;
} udp;
struct {
u_int8_t type, code;
} icmp;
struct {
__be16 port;
} dccp;
struct {
__be16 port;
} sctp;
struct {
__be16 key;
} gre;
} u;
/* The protocol. */
u_int8_t protonum;
/* The direction must be ignored for the tuplehash */
struct { } __nfct_hash_offsetend;
/* The direction (for tuplehash) */
u_int8_t dir;
} dst;
};
struct nf_conntrack_tuple_mask {
struct {
union nf_inet_addr u3;
union nf_conntrack_man_proto u;
} src;
};
static inline void nf_ct_dump_tuple_ip(const struct nf_conntrack_tuple *t)
{
#ifdef DEBUG
printk("tuple %p: %u %pI4:%hu -> %pI4:%hu\n",
t, t->dst.protonum,
&t->src.u3.ip, ntohs(t->src.u.all),
&t->dst.u3.ip, ntohs(t->dst.u.all));
#endif
}
static inline void nf_ct_dump_tuple_ipv6(const struct nf_conntrack_tuple *t)
{
#ifdef DEBUG
printk("tuple %p: %u %pI6 %hu -> %pI6 %hu\n",
t, t->dst.protonum,
t->src.u3.all, ntohs(t->src.u.all),
t->dst.u3.all, ntohs(t->dst.u.all));
#endif
}
static inline void nf_ct_dump_tuple(const struct nf_conntrack_tuple *t)
{
switch (t->src.l3num) {
case AF_INET:
nf_ct_dump_tuple_ip(t);
break;
case AF_INET6:
nf_ct_dump_tuple_ipv6(t);
break;
}
}
/* If we're the first tuple, it's the original dir. */
#define NF_CT_DIRECTION(h) \
Annotation
- Immediate include surface: `linux/netfilter.h`, `linux/netfilter/nf_conntrack_tuple_common.h`, `linux/list_nulls.h`.
- Detected declarations: `struct nf_conntrack_man`, `struct nf_conntrack_tuple`, `struct nf_conntrack_tuple_mask`, `struct nf_conntrack_tuple_hash`, `function nf_ct_dump_tuple_ip`, `function nf_ct_dump_tuple_ipv6`, `function nf_ct_dump_tuple`, `function __nf_ct_tuple_src_equal`, `function __nf_ct_tuple_dst_equal`, `function nf_ct_tuple_equal`.
- 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.