net/ipv6/raw.c
Source file repositories/reference/linux-study-clean/net/ipv6/raw.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv6/raw.c- Extension
.c- Size
- 30392 bytes
- Lines
- 1317
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/socket.hlinux/slab.hlinux/sockios.hlinux/net.hlinux/in6.hlinux/netdevice.hlinux/if_arp.hlinux/icmpv6.hlinux/netfilter.hlinux/netfilter_ipv6.hlinux/skbuff.hlinux/compat.hlinux/uaccess.hasm/ioctls.hnet/net_namespace.hnet/ip.hnet/sock.hnet/snmp.hnet/ipv6.hnet/ndisc.hnet/protocol.hnet/ip6_route.hnet/ip6_checksum.hnet/addrconf.hnet/transp_v6.hnet/udp.hnet/inet_common.hnet/tcp_states.hnet/mip6.hlinux/mroute6.h
Detected Declarations
struct raw6_frag_vecfunction raw_v6_matchfunction icmpv6_filterfunction rawv6_mh_filter_registerfunction rawv6_mh_filter_unregisterfunction ipv6_raw_deliverfunction raw6_local_deliverfunction rawv6_bindfunction rawv6_errfunction raw6_icmp_errorfunction rawv6_rcv_skbfunction rawv6_rcvfunction rawv6_recvmsgfunction rawv6_push_pending_framesfunction skb_queue_walkfunction rawv6_send_hdrincfunction rawv6_probe_proto_optfunction raw6_getfragfunction rawv6_sendmsgfunction rawv6_seticmpfilterfunction rawv6_geticmpfilterfunction do_rawv6_setsockoptfunction rawv6_setsockoptfunction do_rawv6_getsockoptfunction rawv6_getsockoptfunction rawv6_ioctlfunction compat_rawv6_ioctlfunction rawv6_closefunction raw6_destroyfunction rawv6_init_skfunction raw6_seq_showfunction raw6_init_netfunction raw6_exit_netfunction raw6_proc_initfunction raw6_proc_exitfunction rawv6_initfunction rawv6_exitexport raw_v6_hashinfoexport raw_v6_matchexport rawv6_mh_filter_registerexport rawv6_mh_filter_unregister
Annotated Snippet
const struct proto_ops inet6_sockraw_ops = {
.family = PF_INET6,
.owner = THIS_MODULE,
.release = inet6_release,
.bind = inet6_bind,
.connect = inet_dgram_connect, /* ok */
.socketpair = sock_no_socketpair, /* a do nothing */
.accept = sock_no_accept, /* a do nothing */
.getname = inet6_getname,
.poll = datagram_poll, /* ok */
.ioctl = inet6_ioctl, /* must change */
.gettstamp = sock_gettstamp,
.listen = sock_no_listen, /* ok */
.shutdown = inet_shutdown, /* ok */
.setsockopt = sock_common_setsockopt, /* ok */
.getsockopt = sock_common_getsockopt, /* ok */
.sendmsg = inet_sendmsg, /* ok */
.recvmsg = sock_common_recvmsg, /* ok */
.mmap = sock_no_mmap,
#ifdef CONFIG_COMPAT
.compat_ioctl = inet6_compat_ioctl,
#endif
};
static struct inet_protosw rawv6_protosw = {
.type = SOCK_RAW,
.protocol = IPPROTO_IP, /* wild card */
.prot = &rawv6_prot,
.ops = &inet6_sockraw_ops,
.flags = INET_PROTOSW_REUSE,
};
int __init rawv6_init(void)
{
return inet6_register_protosw(&rawv6_protosw);
}
void rawv6_exit(void)
{
inet6_unregister_protosw(&rawv6_protosw);
}
Annotation
- Immediate include surface: `linux/errno.h`, `linux/types.h`, `linux/socket.h`, `linux/slab.h`, `linux/sockios.h`, `linux/net.h`, `linux/in6.h`, `linux/netdevice.h`.
- Detected declarations: `struct raw6_frag_vec`, `function raw_v6_match`, `function icmpv6_filter`, `function rawv6_mh_filter_register`, `function rawv6_mh_filter_unregister`, `function ipv6_raw_deliver`, `function raw6_local_deliver`, `function rawv6_bind`, `function rawv6_err`, `function raw6_icmp_error`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.