net/ipv6/netfilter/nf_conntrack_reasm.c
Source file repositories/reference/linux-study-clean/net/ipv6/netfilter/nf_conntrack_reasm.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv6/netfilter/nf_conntrack_reasm.c- Extension
.c- Size
- 14095 bytes
- Lines
- 580
- 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/errno.hlinux/types.hlinux/string.hlinux/net.hlinux/netdevice.hlinux/ipv6.hlinux/slab.hnet/ipv6_frag.hnet/netfilter/ipv6/nf_conntrack_ipv6.hlinux/sysctl.hlinux/netfilter.hlinux/netfilter_ipv6.hlinux/kernel.hlinux/module.hnet/netfilter/ipv6/nf_defrag_ipv6.hnet/netns/generic.h
Detected Declarations
function nf_ct_frag6_sysctl_registerfunction nf_ct_frags6_sysctl_unregisterfunction nf_ct_frag6_sysctl_registerfunction nf_ct_frags6_sysctl_unregisterfunction ip6_frag_ecnfunction nf_ct_frag6_expirefunction nf_ct_frag6_queuefunction nf_ct_frag6_reasmfunction ipv6_skip_hdrfunction nf_ct_frag6_gatherfunction nf_ct_net_initfunction nf_ct_net_pre_exitfunction nf_ct_net_exitfunction nf_ct_frag6_initfunction nf_ct_frag6_cleanupexport nf_ct_frag6_gather
Annotated Snippet
if (end & 0x7) {
/* RFC2460 says always send parameter problem in
* this case. -DaveM
*/
pr_debug("end of fragment not rounded to 8 bytes.\n");
inet_frag_kill(&fq->q, refs);
return -EPROTO;
}
if (end > fq->q.len) {
/* Some bits beyond end -> corruption. */
if (fq->q.flags & INET_FRAG_LAST_IN) {
pr_debug("last packet already reached.\n");
goto err;
}
fq->q.len = end;
}
}
if (end == offset)
goto err;
/* Point into the IP datagram 'data' part. */
if (!pskb_pull(skb, (u8 *) (fhdr + 1) - skb->data)) {
pr_debug("queue: message is too short.\n");
goto err;
}
if (pskb_trim_rcsum(skb, end - offset)) {
pr_debug("Can't trim\n");
goto err;
}
/* Note : skb->rbnode and skb->dev share the same location. */
dev = skb->dev;
/* Makes sure compiler wont do silly aliasing games */
barrier();
prev = fq->q.fragments_tail;
err = inet_frag_queue_insert(&fq->q, skb, offset, end);
if (err) {
if (err == IPFRAG_DUP) {
/* No error for duplicates, pretend they got queued. */
kfree_skb_reason(skb, SKB_DROP_REASON_DUP_FRAG);
return -EINPROGRESS;
}
goto insert_error;
}
if (dev)
fq->iif = dev->ifindex;
fq->q.stamp = skb->tstamp;
fq->q.tstamp_type = skb->tstamp_type;
fq->q.meat += skb->len;
fq->ecn |= ecn;
if (payload_len > fq->q.max_size)
fq->q.max_size = payload_len;
add_frag_mem_limit(fq->q.fqdir, skb->truesize);
/* The first fragment.
* nhoffset is obtained from the first fragment, of course.
*/
if (offset == 0) {
fq->nhoffset = nhoff;
fq->q.flags |= INET_FRAG_FIRST_IN;
}
if (fq->q.flags == (INET_FRAG_FIRST_IN | INET_FRAG_LAST_IN) &&
fq->q.meat == fq->q.len) {
unsigned long orefdst = skb->_skb_refdst;
skb->_skb_refdst = 0UL;
err = nf_ct_frag6_reasm(fq, skb, prev, dev, refs);
skb->_skb_refdst = orefdst;
/* After queue has assumed skb ownership, only 0 or
* -EINPROGRESS must be returned.
*/
return err ? -EINPROGRESS : 0;
}
skb_dst_drop(skb);
skb_orphan(skb);
return -EINPROGRESS;
insert_error:
inet_frag_kill(&fq->q, refs);
err:
skb_dst_drop(skb);
return -EINVAL;
}
Annotation
- Immediate include surface: `linux/errno.h`, `linux/types.h`, `linux/string.h`, `linux/net.h`, `linux/netdevice.h`, `linux/ipv6.h`, `linux/slab.h`, `net/ipv6_frag.h`.
- Detected declarations: `function nf_ct_frag6_sysctl_register`, `function nf_ct_frags6_sysctl_unregister`, `function nf_ct_frag6_sysctl_register`, `function nf_ct_frags6_sysctl_unregister`, `function ip6_frag_ecn`, `function nf_ct_frag6_expire`, `function nf_ct_frag6_queue`, `function nf_ct_frag6_reasm`, `function ipv6_skip_hdr`, `function nf_ct_frag6_gather`.
- 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.