net/ipv4/igmp.c
Source file repositories/reference/linux-study-clean/net/ipv4/igmp.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv4/igmp.c- Extension
.c- Size
- 78243 bytes
- Lines
- 3220
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/module.hlinux/slab.hlinux/uaccess.hlinux/types.hlinux/kernel.hlinux/jiffies.hlinux/string.hlinux/socket.hlinux/sockios.hlinux/in.hlinux/inet.hlinux/netdevice.hlinux/skbuff.hlinux/inetdevice.hlinux/igmp.higmp_internal.hlinux/if_arp.hlinux/rtnetlink.hlinux/times.hlinux/pkt_sched.hlinux/byteorder/generic.hnet/net_namespace.hnet/netlink.hnet/addrconf.hnet/arp.hnet/ip.hnet/protocol.hnet/route.hnet/sock.hnet/checksum.hnet/inet_common.hlinux/netfilter_ipv4.h
Detected Declarations
struct igmp_mc_iter_statestruct igmp_mcf_iter_statefunction otherwisefunction IGMP_V2_SEENfunction unsolicited_report_intervalfunction ip_ma_putfunction ip_sf_list_clear_allfunction igmp_stop_timerfunction igmp_start_timerfunction igmp_gq_start_timerfunction igmp_ifc_start_timerfunction igmp_mod_timerfunction is_infunction igmp_scountfunction igmpv3_get_srcaddrfunction in_dev_for_each_ifa_rcufunction igmpv3_sendpackfunction grec_sizefunction igmpv3_send_reportfunction for_each_pmc_rcufunction igmpv3_clear_zerosfunction kfree_pmcfunction igmpv3_send_crfunction igmp_send_reportfunction igmp_gq_timer_expirefunction igmp_ifc_timer_expirefunction igmp_ifc_eventfunction igmp_timer_expirefunction igmp_xmarksourcesfunction igmp_marksourcesfunction igmp_heard_reportfunction igmp_heard_queryfunction igmp_rcvfunction ip_mc_filter_addfunction ip_mc_filter_delfunction igmpv3_add_delrecfunction igmpv3_del_delrecfunction igmpv3_clear_delrecfunction __igmp_group_droppedfunction igmp_group_droppedfunction igmp_group_addedfunction ip_mc_hashfunction ip_mc_hash_addfunction for_each_pmc_rtnlfunction ip_mc_hash_removefunction inet_fill_ifmcaddrfunction inet_ifmcaddr_notifyfunction ____ip_mc_inc_group
Annotated Snippet
struct igmp_mc_iter_state {
struct seq_net_private p;
struct net_device *dev;
struct in_device *in_dev;
};
#define igmp_mc_seq_private(seq) ((struct igmp_mc_iter_state *)(seq)->private)
static inline struct ip_mc_list *igmp_mc_get_first(struct seq_file *seq)
{
struct net *net = seq_file_net(seq);
struct ip_mc_list *im = NULL;
struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
state->in_dev = NULL;
for_each_netdev_rcu(net, state->dev) {
struct in_device *in_dev;
in_dev = __in_dev_get_rcu(state->dev);
if (!in_dev)
continue;
im = rcu_dereference(in_dev->mc_list);
if (im) {
state->in_dev = in_dev;
break;
}
}
return im;
}
static struct ip_mc_list *igmp_mc_get_next(struct seq_file *seq, struct ip_mc_list *im)
{
struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
im = rcu_dereference(im->next_rcu);
while (!im) {
state->dev = next_net_device_rcu(state->dev);
if (!state->dev) {
state->in_dev = NULL;
break;
}
state->in_dev = __in_dev_get_rcu(state->dev);
if (!state->in_dev)
continue;
im = rcu_dereference(state->in_dev->mc_list);
}
return im;
}
static struct ip_mc_list *igmp_mc_get_idx(struct seq_file *seq, loff_t pos)
{
struct ip_mc_list *im = igmp_mc_get_first(seq);
if (im)
while (pos && (im = igmp_mc_get_next(seq, im)) != NULL)
--pos;
return pos ? NULL : im;
}
static void *igmp_mc_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(rcu)
{
rcu_read_lock();
return *pos ? igmp_mc_get_idx(seq, *pos - 1) : SEQ_START_TOKEN;
}
static void *igmp_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct ip_mc_list *im;
if (v == SEQ_START_TOKEN)
im = igmp_mc_get_first(seq);
else
im = igmp_mc_get_next(seq, v);
++*pos;
return im;
}
static void igmp_mc_seq_stop(struct seq_file *seq, void *v)
__releases(rcu)
{
struct igmp_mc_iter_state *state = igmp_mc_seq_private(seq);
state->in_dev = NULL;
state->dev = NULL;
rcu_read_unlock();
}
static int igmp_mc_seq_show(struct seq_file *seq, void *v)
{
if (v == SEQ_START_TOKEN)
seq_puts(seq,
Annotation
- Immediate include surface: `linux/module.h`, `linux/slab.h`, `linux/uaccess.h`, `linux/types.h`, `linux/kernel.h`, `linux/jiffies.h`, `linux/string.h`, `linux/socket.h`.
- Detected declarations: `struct igmp_mc_iter_state`, `struct igmp_mcf_iter_state`, `function otherwise`, `function IGMP_V2_SEEN`, `function unsolicited_report_interval`, `function ip_ma_put`, `function ip_sf_list_clear_all`, `function igmp_stop_timer`, `function igmp_start_timer`, `function igmp_gq_start_timer`.
- 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.