include/net/netfilter/nf_conntrack_timeout.h
Source file repositories/reference/linux-study-clean/include/net/netfilter/nf_conntrack_timeout.h
File Facts
- System
- Linux kernel
- Corpus path
include/net/netfilter/nf_conntrack_timeout.h- Extension
.h- Size
- 3254 bytes
- Lines
- 136
- 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
net/net_namespace.hlinux/netfilter/nf_conntrack_common.hlinux/netfilter/nf_conntrack_tuple_common.hlinux/refcount.hnet/netfilter/nf_conntrack.hnet/netfilter/nf_conntrack_extend.h
Detected Declarations
struct nf_ct_timeoutstruct nf_conn_timeoutstruct nf_ct_timeout_hooksfunction nf_ct_timeout_putfunction nf_ct_timeout_datafunction nf_ct_set_timeoutfunction nf_ct_destroy_timeout
Annotated Snippet
struct nf_ct_timeout {
refcount_t refcnt;
__u16 l3num;
const struct nf_conntrack_l4proto *l4proto;
struct rcu_head rcu;
char data[];
};
struct nf_conn_timeout {
struct nf_ct_timeout __rcu *timeout;
};
static inline void nf_ct_timeout_put(const struct nf_conn *ct)
{
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
struct nf_conn_timeout *timeout_ext;
struct nf_ct_timeout *timeout;
timeout_ext = nf_ct_ext_find(ct, NF_CT_EXT_TIMEOUT);
if (!timeout_ext)
return;
timeout = rcu_dereference(timeout_ext->timeout);
if (timeout && refcount_dec_and_test(&timeout->refcnt))
kfree_rcu(timeout, rcu);
#endif
}
static inline unsigned int *
nf_ct_timeout_data(const struct nf_conn_timeout *t)
{
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
struct nf_ct_timeout *timeout;
timeout = rcu_dereference(t->timeout);
if (timeout == NULL)
return NULL;
return (unsigned int *)timeout->data;
#else
return NULL;
#endif
}
static inline
struct nf_conn_timeout *nf_ct_timeout_find(const struct nf_conn *ct)
{
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
return nf_ct_ext_find(ct, NF_CT_EXT_TIMEOUT);
#else
return NULL;
#endif
}
static inline
struct nf_conn_timeout *nf_ct_timeout_ext_add(struct nf_conn *ct,
struct nf_ct_timeout *timeout,
gfp_t gfp)
{
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
struct nf_conn_timeout *timeout_ext;
if (!timeout)
return NULL;
timeout_ext = nf_ct_ext_add(ct, NF_CT_EXT_TIMEOUT, gfp);
if (!timeout_ext || timeout_ext->timeout)
return NULL;
if (!refcount_inc_not_zero(&timeout->refcnt))
return NULL;
rcu_assign_pointer(timeout_ext->timeout, timeout);
return timeout_ext;
#else
return NULL;
#endif
};
static inline unsigned int *nf_ct_timeout_lookup(const struct nf_conn *ct)
{
unsigned int *timeouts = NULL;
#ifdef CONFIG_NF_CONNTRACK_TIMEOUT
struct nf_conn_timeout *timeout_ext;
timeout_ext = nf_ct_timeout_find(ct);
if (timeout_ext && rcu_access_pointer(timeout_ext->timeout))
timeouts = nf_ct_timeout_data(timeout_ext);
#endif
Annotation
- Immediate include surface: `net/net_namespace.h`, `linux/netfilter/nf_conntrack_common.h`, `linux/netfilter/nf_conntrack_tuple_common.h`, `linux/refcount.h`, `net/netfilter/nf_conntrack.h`, `net/netfilter/nf_conntrack_extend.h`.
- Detected declarations: `struct nf_ct_timeout`, `struct nf_conn_timeout`, `struct nf_ct_timeout_hooks`, `function nf_ct_timeout_put`, `function nf_ct_timeout_data`, `function nf_ct_set_timeout`, `function nf_ct_destroy_timeout`.
- 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.