netlink: add IGMP/MLD join/leave notifications
authorYuyang Huang <yuyanghuang@google.com>
Wed, 11 Dec 2024 08:22:41 +0000 (17:22 +0900)
committerDavid S. Miller <davem@davemloft.net>
Sun, 15 Dec 2024 12:31:35 +0000 (12:31 +0000)
commit2c2b61d2138f472e50b5531ec0cb4a1485837e21
tree149f8a01ba9d8b976eab555a3beb1981baad6b45
parent9bc5c9515b4817e994579b21c32c033cbb3b0e6c
netlink: add IGMP/MLD join/leave notifications

This change introduces netlink notifications for multicast address
changes. The following features are included:
* Addition and deletion of multicast addresses are reported using
  RTM_NEWMULTICAST and RTM_DELMULTICAST messages with AF_INET and
  AF_INET6.
* Two new notification groups: RTNLGRP_IPV4_MCADDR and
  RTNLGRP_IPV6_MCADDR are introduced for receiving these events.

This change allows user space applications (e.g., ip monitor) to
efficiently track multicast group memberships by listening for netlink
events. Previously, applications relied on inefficient polling of
procfs, introducing delays. With netlink notifications, applications
receive realtime updates on multicast group membership changes,
enabling more precise metrics collection and system monitoring. 

This change also unlocks the potential for implementing a wide range
of sophisticated multicast related features in user space by allowing
applications to combine kernel provided multicast address information
with user space data and communicate decisions back to the kernel for
more fine grained control. This mechanism can be used for various
purposes, including multicast filtering, IGMP/MLD offload, and
IGMP/MLD snooping.

Cc: Maciej Żenczykowski <maze@google.com>
Cc: Lorenzo Colitti <lorenzo@google.com>
Co-developed-by: Patrick Ruddy <pruddy@vyatta.att-mail.com>
Signed-off-by: Patrick Ruddy <pruddy@vyatta.att-mail.com>
Link: https://lore.kernel.org/r/20180906091056.21109-1-pruddy@vyatta.att-mail.com
Signed-off-by: Yuyang Huang <yuyanghuang@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
include/linux/igmp.h
include/net/addrconf.h
include/uapi/linux/rtnetlink.h
net/ipv4/igmp.c
net/ipv6/addrconf.c
net/ipv6/mcast.c