net/ipv4/icmp.c
Source file repositories/reference/linux-study-clean/net/ipv4/icmp.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv4/icmp.c- Extension
.c- Size
- 45219 bytes
- Lines
- 1770
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/types.hlinux/jiffies.hlinux/kernel.hlinux/fcntl.hlinux/nospec.hlinux/socket.hlinux/in.hlinux/inet.hlinux/inetdevice.hlinux/netdevice.hlinux/string.hlinux/netfilter_ipv4.hlinux/slab.hnet/flow.hnet/snmp.hnet/ip.hnet/route.hnet/protocol.hnet/icmp.hnet/tcp.hnet/udp.hnet/raw.hnet/ping.hlinux/skbuff.hnet/sock.hlinux/errno.hlinux/timer.hlinux/init.hlinux/uaccess.hnet/checksum.hnet/xfrm.h
Detected Declarations
struct icmp_bxmstruct icmp_controlstruct icmp_ext_iio_addr4_subobjfunction icmp_xmit_unlockfunction icmp_global_consumefunction icmp_global_consumefunction icmpv4_mask_allowfunction icmpv4_global_allowfunction icmpv4_xrlim_allowfunction icmp_out_countfunction icmp_glue_bitsfunction icmp_push_replyfunction skb_queue_walkfunction icmp_replyfunction icmp_ext_iio_lenfunction icmp_ext_max_lenfunction icmp_ext_iio_addr4_findfunction icmp_ext_iio_iif_appendfunction icmp_ext_objs_appendfunction icmp_ext_appendfunction morefunction icmp_ndo_sendfunction icmp_socket_deliverfunction icmp_tag_validationfunction icmp_unreachfunction icmp_redirectfunction ICMP_ECHOfunction icmp_build_probefunction icmp_timestampfunction icmp_discardfunction icmp_rcvfunction ip_icmp_error_rfc4884_validatefunction ip_icmp_error_rfc4884function icmp_errfunction icmp_sk_initfunction icmp_initfunction for_each_possible_cpuexport icmp_err_convertexport __icmp_sendexport icmp_ndo_send
Annotated Snippet
struct icmp_bxm {
struct sk_buff *skb;
int offset;
int data_len;
struct {
struct icmphdr icmph;
__be32 times[3];
} data;
int head_len;
/* Must be last as it ends in a flexible-array member. */
struct ip_options_rcu replyopts;
};
/* An array of errno for error messages from dest unreach. */
/* RFC 1122: 3.2.2.1 States that NET_UNREACH, HOST_UNREACH and SR_FAILED MUST be considered 'transient errs'. */
const struct icmp_err icmp_err_convert[] = {
{
.errno = ENETUNREACH, /* ICMP_NET_UNREACH */
.fatal = 0,
},
{
.errno = EHOSTUNREACH, /* ICMP_HOST_UNREACH */
.fatal = 0,
},
{
.errno = ENOPROTOOPT /* ICMP_PROT_UNREACH */,
.fatal = 1,
},
{
.errno = ECONNREFUSED, /* ICMP_PORT_UNREACH */
.fatal = 1,
},
{
.errno = EMSGSIZE, /* ICMP_FRAG_NEEDED */
.fatal = 0,
},
{
.errno = EOPNOTSUPP, /* ICMP_SR_FAILED */
.fatal = 0,
},
{
.errno = ENETUNREACH, /* ICMP_NET_UNKNOWN */
.fatal = 1,
},
{
.errno = EHOSTDOWN, /* ICMP_HOST_UNKNOWN */
.fatal = 1,
},
{
.errno = ENONET, /* ICMP_HOST_ISOLATED */
.fatal = 1,
},
{
.errno = ENETUNREACH, /* ICMP_NET_ANO */
.fatal = 1,
},
{
.errno = EHOSTUNREACH, /* ICMP_HOST_ANO */
.fatal = 1,
},
{
.errno = ENETUNREACH, /* ICMP_NET_UNR_TOS */
.fatal = 0,
},
{
.errno = EHOSTUNREACH, /* ICMP_HOST_UNR_TOS */
.fatal = 0,
},
{
.errno = EHOSTUNREACH, /* ICMP_PKT_FILTERED */
.fatal = 1,
},
{
.errno = EHOSTUNREACH, /* ICMP_PREC_VIOLATION */
.fatal = 1,
},
{
.errno = EHOSTUNREACH, /* ICMP_PREC_CUTOFF */
.fatal = 1,
},
};
EXPORT_SYMBOL(icmp_err_convert);
/*
* ICMP control array. This specifies what to do with each ICMP.
*/
Annotation
- Immediate include surface: `linux/module.h`, `linux/types.h`, `linux/jiffies.h`, `linux/kernel.h`, `linux/fcntl.h`, `linux/nospec.h`, `linux/socket.h`, `linux/in.h`.
- Detected declarations: `struct icmp_bxm`, `struct icmp_control`, `struct icmp_ext_iio_addr4_subobj`, `function icmp_xmit_unlock`, `function icmp_global_consume`, `function icmp_global_consume`, `function icmpv4_mask_allow`, `function icmpv4_global_allow`, `function icmpv4_xrlim_allow`, `function icmp_out_count`.
- 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.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.