net/ipv6/mcast.c
Source file repositories/reference/linux-study-clean/net/ipv6/mcast.c
File Facts
- System
- Linux kernel
- Corpus path
net/ipv6/mcast.c- Extension
.c- Size
- 78812 bytes
- Lines
- 3252
- 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/errno.hlinux/types.hlinux/string.hlinux/socket.hlinux/sockios.hlinux/jiffies.hlinux/net.hlinux/in.hlinux/in6.hlinux/netdevice.hlinux/if_addr.hlinux/if_arp.hlinux/route.hlinux/rtnetlink.hlinux/init.hlinux/proc_fs.hlinux/seq_file.hlinux/slab.hlinux/pkt_sched.hnet/mld.hlinux/workqueue.hlinux/netfilter.hlinux/netfilter_ipv6.hnet/net_namespace.hnet/netlink.hnet/sock.hnet/snmp.hnet/ipv6.hnet/protocol.hnet/if_inet6.hnet/ndisc.h
Detected Declarations
struct igmp6_mc_iter_statestruct igmp6_mcf_iter_statefunction unsolicited_report_intervalfunction __ipv6_sock_mc_joinfunction for_each_pmc_socklockfunction ipv6_sock_mc_joinfunction ipv6_sock_mc_join_ssmfunction __ipv6_sock_mc_dropfunction ipv6_sock_mc_dropfunction __ipv6_sock_mc_closefunction ipv6_sock_mc_closefunction ip6_mc_sourcefunction for_each_pmc_socklockfunction ip6_mc_msfilterfunction for_each_pmc_socklockfunction ip6_mc_msfgetfunction for_each_pmc_socklockfunction inet6_mc_checkfunction igmp6_group_addedfunction igmp6_group_droppedfunction mld_add_delrecfunction mld_del_delrecfunction mld_clear_delrecfunction mld_clear_queryfunction mld_clear_reportfunction ma_putfunction inet6_ifmcaddr_notifyfunction incfunction for_each_mc_mclockfunction ipv6_dev_mc_incfunction __ipv6_dev_mc_decfunction ipv6_dev_mc_decfunction ipv6_chk_mcast_addrfunction for_each_psf_rcufunction mld_gq_start_workfunction mld_gq_stop_workfunction mld_ifc_start_workfunction mld_ifc_stop_workfunction mld_dad_start_workfunction mld_dad_stop_workfunction mld_query_stop_workfunction mld_report_stop_workfunction igmp6_group_queriedfunction mld_xmarksourcesfunction mld_marksourcesfunction mld_force_mld_versionfunction mld_in_v2_mode_onlyfunction mld_in_v1_mode_only
Annotated Snippet
struct igmp6_mc_iter_state {
struct seq_net_private p;
struct net_device *dev;
struct inet6_dev *idev;
};
#define igmp6_mc_seq_private(seq) ((struct igmp6_mc_iter_state *)(seq)->private)
static inline struct ifmcaddr6 *igmp6_mc_get_first(struct seq_file *seq)
{
struct ifmcaddr6 *im = NULL;
struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
struct net *net = seq_file_net(seq);
state->idev = NULL;
for_each_netdev_rcu(net, state->dev) {
struct inet6_dev *idev;
idev = __in6_dev_get(state->dev);
if (!idev)
continue;
im = rcu_dereference(idev->mc_list);
if (im) {
state->idev = idev;
break;
}
}
return im;
}
static struct ifmcaddr6 *igmp6_mc_get_next(struct seq_file *seq, struct ifmcaddr6 *im)
{
struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
im = rcu_dereference(im->next);
while (!im) {
state->dev = next_net_device_rcu(state->dev);
if (!state->dev) {
state->idev = NULL;
break;
}
state->idev = __in6_dev_get(state->dev);
if (!state->idev)
continue;
im = rcu_dereference(state->idev->mc_list);
}
return im;
}
static struct ifmcaddr6 *igmp6_mc_get_idx(struct seq_file *seq, loff_t pos)
{
struct ifmcaddr6 *im = igmp6_mc_get_first(seq);
if (im)
while (pos && (im = igmp6_mc_get_next(seq, im)) != NULL)
--pos;
return pos ? NULL : im;
}
static void *igmp6_mc_seq_start(struct seq_file *seq, loff_t *pos)
__acquires(RCU)
{
rcu_read_lock();
return igmp6_mc_get_idx(seq, *pos);
}
static void *igmp6_mc_seq_next(struct seq_file *seq, void *v, loff_t *pos)
{
struct ifmcaddr6 *im = igmp6_mc_get_next(seq, v);
++*pos;
return im;
}
static void igmp6_mc_seq_stop(struct seq_file *seq, void *v)
__releases(RCU)
{
struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
if (likely(state->idev))
state->idev = NULL;
state->dev = NULL;
rcu_read_unlock();
}
static int igmp6_mc_seq_show(struct seq_file *seq, void *v)
{
struct ifmcaddr6 *im = (struct ifmcaddr6 *)v;
struct igmp6_mc_iter_state *state = igmp6_mc_seq_private(seq);
unsigned int mca_flags = READ_ONCE(im->mca_flags);
unsigned long expires = READ_ONCE(im->mca_work.timer.expires);
Annotation
- Immediate include surface: `linux/module.h`, `linux/errno.h`, `linux/types.h`, `linux/string.h`, `linux/socket.h`, `linux/sockios.h`, `linux/jiffies.h`, `linux/net.h`.
- Detected declarations: `struct igmp6_mc_iter_state`, `struct igmp6_mcf_iter_state`, `function unsolicited_report_interval`, `function __ipv6_sock_mc_join`, `function for_each_pmc_socklock`, `function ipv6_sock_mc_join`, `function ipv6_sock_mc_join_ssm`, `function __ipv6_sock_mc_drop`, `function ipv6_sock_mc_drop`, `function __ipv6_sock_mc_close`.
- 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.