net/netfilter/utils.c
Source file repositories/reference/linux-study-clean/net/netfilter/utils.c
File Facts
- System
- Linux kernel
- Corpus path
net/netfilter/utils.c- Extension
.c- Size
- 5605 bytes
- Lines
- 232
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/netfilter.hlinux/netfilter_ipv4.hlinux/netfilter_ipv6.hnet/netfilter/nf_queue.hnet/ip6_checksum.h
Detected Declarations
function nf_ip_checksumfunction nf_ip_checksum_partialfunction nf_ip6_checksumfunction nf_ip6_checksum_partialfunction nf_checksumfunction nf_checksum_partialfunction nf_routefunction nf_ip6_check_hbh_lenexport nf_ip_checksumexport nf_ip6_checksumexport nf_checksumexport nf_checksum_partialexport nf_routeexport nf_ip6_check_hbh_len
Annotated Snippet
if (nh[off] == IPV6_TLV_PAD1) {
off++;
len--;
continue;
}
if (len < 2)
return -EBADMSG;
optlen = nh[off + 1] + 2;
if (optlen > len)
return -EBADMSG;
if (nh[off] == IPV6_TLV_JUMBO) {
u32 pkt_len;
if (nh[off + 1] != 4 || (off & 3) != 2)
return -EBADMSG;
pkt_len = ntohl(*(__be32 *)(nh + off + 2));
if (pkt_len <= IPV6_MAXPLEN ||
ipv6_hdr(skb)->payload_len)
return -EBADMSG;
if (pkt_len > skb->len - sizeof(struct ipv6hdr))
return -EBADMSG;
*plen = pkt_len;
}
off += optlen;
len -= optlen;
}
return len ? -EBADMSG : 0;
}
EXPORT_SYMBOL_GPL(nf_ip6_check_hbh_len);
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/netfilter.h`, `linux/netfilter_ipv4.h`, `linux/netfilter_ipv6.h`, `net/netfilter/nf_queue.h`, `net/ip6_checksum.h`.
- Detected declarations: `function nf_ip_checksum`, `function nf_ip_checksum_partial`, `function nf_ip6_checksum`, `function nf_ip6_checksum_partial`, `function nf_checksum`, `function nf_checksum_partial`, `function nf_route`, `function nf_ip6_check_hbh_len`, `export nf_ip_checksum`, `export nf_ip6_checksum`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration 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.