net/ipv6/xfrm6_protocol.c
Source file repositories/reference/linux-study-clean/net/ipv6/xfrm6_protocol.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv6/xfrm6_protocol.c- Extension
.c- Size
- 7612 bytes
- Lines
- 330
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- 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/init.hlinux/mutex.hlinux/skbuff.hlinux/icmpv6.hnet/ip6_route.hnet/ipv6.hnet/protocol.hnet/xfrm.h
Detected Declarations
function xfrm6_rcv_cbfunction xfrm6_rcv_encapfunction xfrm6_esp_rcvfunction xfrm6_esp_errfunction xfrm6_ah_rcvfunction xfrm6_ah_errfunction xfrm6_ipcomp_rcvfunction xfrm6_ipcomp_errfunction xfrm6_protocol_registerfunction xfrm6_protocol_deregisterfunction xfrm6_protocol_initfunction xfrm6_protocol_finiexport xfrm6_rcv_encapexport xfrm6_protocol_registerexport xfrm6_protocol_deregister
Annotated Snippet
if (dst->error) {
dst_release(dst);
goto drop;
}
skb_dst_set(skb, dst);
}
for_each_protocol_rcu(*head, handler)
if ((ret = handler->input_handler(skb, nexthdr, spi, encap_type)) != -EINVAL)
return ret;
out:
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
drop:
kfree_skb(skb);
return 0;
}
EXPORT_SYMBOL(xfrm6_rcv_encap);
static int xfrm6_esp_rcv(struct sk_buff *skb)
{
int ret;
struct xfrm6_protocol *handler;
XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL;
for_each_protocol_rcu(esp6_handlers, handler)
if ((ret = handler->handler(skb)) != -EINVAL)
return ret;
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
kfree_skb(skb);
return 0;
}
static int xfrm6_esp_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, __be32 info)
{
struct xfrm6_protocol *handler;
for_each_protocol_rcu(esp6_handlers, handler)
if (!handler->err_handler(skb, opt, type, code, offset, info))
return 0;
return -ENOENT;
}
static int xfrm6_ah_rcv(struct sk_buff *skb)
{
int ret;
struct xfrm6_protocol *handler;
XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL;
for_each_protocol_rcu(ah6_handlers, handler)
if ((ret = handler->handler(skb)) != -EINVAL)
return ret;
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
kfree_skb(skb);
return 0;
}
static int xfrm6_ah_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
u8 type, u8 code, int offset, __be32 info)
{
struct xfrm6_protocol *handler;
for_each_protocol_rcu(ah6_handlers, handler)
if (!handler->err_handler(skb, opt, type, code, offset, info))
return 0;
return -ENOENT;
}
static int xfrm6_ipcomp_rcv(struct sk_buff *skb)
{
int ret;
struct xfrm6_protocol *handler;
XFRM_TUNNEL_SKB_CB(skb)->tunnel.ip6 = NULL;
for_each_protocol_rcu(ipcomp6_handlers, handler)
if ((ret = handler->handler(skb)) != -EINVAL)
return ret;
icmpv6_send(skb, ICMPV6_DEST_UNREACH, ICMPV6_PORT_UNREACH, 0);
Annotation
- Immediate include surface: `linux/init.h`, `linux/mutex.h`, `linux/skbuff.h`, `linux/icmpv6.h`, `net/ip6_route.h`, `net/ipv6.h`, `net/protocol.h`, `net/xfrm.h`.
- Detected declarations: `function xfrm6_rcv_cb`, `function xfrm6_rcv_encap`, `function xfrm6_esp_rcv`, `function xfrm6_esp_err`, `function xfrm6_ah_rcv`, `function xfrm6_ah_err`, `function xfrm6_ipcomp_rcv`, `function xfrm6_ipcomp_err`, `function xfrm6_protocol_register`, `function xfrm6_protocol_deregister`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.