include/net/netfilter/nf_conntrack.h
Source file repositories/reference/linux-study-clean/include/net/netfilter/nf_conntrack.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/netfilter/nf_conntrack.h- Extension
.h- Size
- 10754 bytes
- Lines
- 385
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/compiler.hnet/netns/generic.hlinux/netfilter/nf_conntrack_common.hlinux/netfilter/nf_conntrack_tcp.hlinux/netfilter/nf_conntrack_sctp.hlinux/netfilter/nf_conntrack_proto_gre.hnet/netfilter/nf_conntrack_tuple.hlinux/types.hlinux/skbuff.hnet/netfilter/ipv4/nf_conntrack_ipv4.hnet/netfilter/ipv6/nf_conntrack_ipv6.h
Detected Declarations
struct nf_ct_udpstruct nf_conntrack_net_ecachestruct nf_conntrack_netstruct nf_connstruct nf_ct_iter_datastruct nf_conntrack_zonestruct kernel_paramfunction nf_ct_to_nf_connfunction nf_ct_tuplehash_to_ctrackfunction nf_ct_l3numfunction nf_ct_protonumfunction nf_ct_getfunction nf_ct_putfunction nf_ct_refresh_acctfunction nf_ct_refreshfunction nf_ct_killfunction nf_ct_is_templatefunction nf_ct_is_confirmedfunction nf_ct_is_dyingfunction nf_is_loopback_packetfunction nf_conntrack_alter_replyfunction nf_ct_expiresfunction nf_ct_is_expiredfunction nf_ct_should_gcfunction nf_conntrack_get_htfunction nf_ct_set
Annotated Snippet
struct nf_ct_udp {
unsigned long stream_ts;
};
/* per conntrack: protocol private data */
union nf_conntrack_proto {
/* insert conntrack proto private data here */
struct ip_ct_sctp sctp;
struct ip_ct_tcp tcp;
struct nf_ct_udp udp;
struct nf_ct_gre gre;
unsigned int tmpl_padto;
};
union nf_conntrack_expect_proto {
/* insert expect proto private data here */
};
struct nf_conntrack_net_ecache {
struct delayed_work dwork;
spinlock_t dying_lock;
struct hlist_nulls_head dying_list;
};
struct nf_conntrack_net {
/* only used when new connection is allocated: */
atomic_t count;
unsigned int expect_count;
/* only used from work queues, configuration plane, and so on: */
unsigned int users4;
unsigned int users6;
unsigned int users_bridge;
#ifdef CONFIG_SYSCTL
struct ctl_table_header *sysctl_header;
#endif
#ifdef CONFIG_NF_CONNTRACK_EVENTS
struct nf_conntrack_net_ecache ecache;
#endif
};
#include <linux/types.h>
#include <linux/skbuff.h>
#include <net/netfilter/ipv4/nf_conntrack_ipv4.h>
#include <net/netfilter/ipv6/nf_conntrack_ipv6.h>
struct nf_conn {
/* Usage count in here is 1 for hash table, 1 per skb,
* plus 1 for any connection(s) we are `master' for
*
* Hint, SKB address this struct and refcnt via skb->_nfct and
* helpers nf_conntrack_get() and nf_conntrack_put().
* Helper nf_ct_put() equals nf_conntrack_put() by dec refcnt,
* except that the latter uses internal indirection and does not
* result in a conntrack module dependency.
* beware nf_ct_get() is different and don't inc refcnt.
*/
struct nf_conntrack ct_general;
spinlock_t lock;
/* jiffies32 when this ct is considered dead */
u32 timeout;
#ifdef CONFIG_NF_CONNTRACK_ZONES
struct nf_conntrack_zone zone;
#endif
/* XXX should I move this to the tail ? - Y.K */
/* These are my tuples; original and reply */
struct nf_conntrack_tuple_hash tuplehash[IP_CT_DIR_MAX];
/* Have we seen traffic both ways yet? (bitset) */
unsigned long status;
possible_net_t ct_net;
#if IS_ENABLED(CONFIG_NF_NAT)
struct hlist_node nat_bysource;
#endif
/* all members below initialized via memset */
struct { } __nfct_init_offset;
/* If we were expected by an expectation, this will be it */
struct nf_conn *master;
#if defined(CONFIG_NF_CONNTRACK_MARK)
u_int32_t mark;
#endif
#ifdef CONFIG_NF_CONNTRACK_SECMARK
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/compiler.h`, `net/netns/generic.h`, `linux/netfilter/nf_conntrack_common.h`, `linux/netfilter/nf_conntrack_tcp.h`, `linux/netfilter/nf_conntrack_sctp.h`, `linux/netfilter/nf_conntrack_proto_gre.h`, `net/netfilter/nf_conntrack_tuple.h`.
- Detected declarations: `struct nf_ct_udp`, `struct nf_conntrack_net_ecache`, `struct nf_conntrack_net`, `struct nf_conn`, `struct nf_ct_iter_data`, `struct nf_conntrack_zone`, `struct kernel_param`, `function nf_ct_to_nf_conn`, `function nf_ct_tuplehash_to_ctrack`, `function nf_ct_l3num`.
- 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.
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.