include/net/netfilter/nf_conntrack_extend.h

Source file repositories/reference/linux-study-clean/include/net/netfilter/nf_conntrack_extend.h

File Facts

System
Linux kernel
Corpus path
include/net/netfilter/nf_conntrack_extend.h
Extension
.h
Size
1454 bytes
Lines
68
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct nf_ct_ext {
	u8 offset[NF_CT_EXT_NUM];
	u8 len;
	char data[] __aligned(8);
};

static inline bool __nf_ct_ext_exist(const struct nf_ct_ext *ext, u8 id)
{
	return !!ext->offset[id];
}

static inline bool nf_ct_ext_exist(const struct nf_conn *ct, u8 id)
{
	return (ct->ext && __nf_ct_ext_exist(ct->ext, id));
}

static inline void *nf_ct_ext_find(const struct nf_conn *ct, u8 id)
{
	struct nf_ct_ext *ext = ct->ext;

	if (!ext || !__nf_ct_ext_exist(ext, id))
		return NULL;

	return (void *)ct->ext + ct->ext->offset[id];
}

/* Add this type, returns pointer to data or NULL. */
void *nf_ct_ext_add(struct nf_conn *ct, enum nf_ct_ext_id id, gfp_t gfp);

#endif /* _NF_CONNTRACK_EXTEND_H */

Annotation

Implementation Notes