STRUCT XFRM_POLICY(9)
π¦ struct xfrm_policy(9) π¦
okay so bestie, this is a page from the Kernel API Manual, and it's literally all about struct xfrm_policy β the xfrm policy struct itself. no cap, it's kind of the main character of the whole IPsec policy world π
β¨ NAME β¨
struct xfrm_policy β the xfrm policy. that's it, that's the vibe π
πΈ SYNOPSIS πΈ
like, here's the whole struct in all its glory, bestie β every single field, exactly as it is, don't @ me:
struct xfrm_policy {
possible_net_t xp_net;
struct hlist_node bydst;
struct hlist_node byidx;
struct hlist_head state_cache_list;
rwlock_t lock;
refcount_t refcnt;
u32 pos;
struct timer_list timer;
atomic_t genid;
u32 priority;
u32 index;
u32 if_id;
struct xfrm_mark mark;
struct xfrm_selector selector;
struct xfrm_lifetime_cfg lft;
struct xfrm_lifetime_cur curlft;
struct xfrm_policy_walk_entry walk;
struct xfrm_policy_queue polq;
bool bydst_reinsert;
u8 type;
u8 action;
u8 flags;
u8 xfrm_nr;
u16 family;
struct xfrm_sec_ctx *security;
struct xfrm_tmpl xfrm_vec[XFRM_MAX_DEPTH];
struct rcu_head rcu;
struct xfrm_dev_offload xdo;
};
π Members π
bestie, here's the member-by-member rundown, in order, no skipping, i promise π«Ά
xp_netβ the network namespace this policy lives in. it's giving "whose house is this" energy.bydstβ hlist node for the SPD hash table or rbtree list.byidxβ hlist node for the index hash table.state_cache_listβ hlist head for the policy's cached xfrm states. caching queen β¨lockβ serializes changes to the policy structure members. one at a time, bestie, we're not animals.refcntβ reference count. it gets freed once it reaches 0. like, that's the whole rule πposβ kernel internal tie-breaker used to determine the age of the policy.timerβ timer. yes. that's literally it. a timer. iconic minimalism πgenidβ generation, used to invalidate old policies. old news gets cancelled, periodt.priorityβ priority, set by userspace.indexβ policy index (autogenerated).if_idβ virtual xfrm interface id.markβ packet mark.selectorβ selector.lftβ lifetime configuration data.curlftβ lifetime state.walkβ list head on the pernet policy list.polqβ queue to hold packets while an acquire operation is in progress. the "hold my packets" queue πbydst_reinsertβ this policy tree node needs to be merged.typeβXFRM_POLICY_TYPE_MAINor_SUB.actionβXFRM_POLICY_ALLOWor_BLOCK.flagsβXFRM_POLICY_LOCALOK,XFRM_POLICY_ICMP.xfrm_nrβ number of used templates inxfrm_vec.familyβ protocol family.securityβ SELinux security label. keeping it secure and cute π₯xfrm_vecβ array of templates to resolve state.rcuβ rcu head, used to defer memory release. bye bestie, but like, later πxdoβ hardware offload state.
π SEE ALSO π
- Kernel file
./include/net/xfrm.h struct xfrm_mode_cbs(9)
and that's the whole page, bestie! π this one came from ./include/net, dated October 2026 β so like, mark your calendars, mwah πβ¨π¦
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms