Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

net: bridge: Send notification when host join/leaves a group

The host can join or leave a multicast group on the brX interface, as
indicated by IGMP snooping. This is tracked within the bridge
multicast code. Send a notification when this happens, in the same way
a notification is sent when a port of the bridge joins/leaves a group
because of IGMP snooping.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
Acked-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Acked-by: Florian Fainelli <f.fainelli@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andrew Lunn and committed by
David S. Miller
2a26028d ff0fd34e

+11 -4
+6 -3
net/bridge/br_mdb.c
··· 317 317 #endif 318 318 319 319 mdb.obj.orig_dev = port_dev; 320 - if (port_dev && type == RTM_NEWMDB) { 320 + if (p && port_dev && type == RTM_NEWMDB) { 321 321 complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC); 322 322 if (complete_info) { 323 323 complete_info->port = p; ··· 327 327 if (switchdev_port_obj_add(port_dev, &mdb.obj)) 328 328 kfree(complete_info); 329 329 } 330 - } else if (port_dev && type == RTM_DELMDB) { 330 + } else if (p && port_dev && type == RTM_DELMDB) { 331 331 switchdev_port_obj_del(port_dev, &mdb.obj); 332 332 } 333 333 ··· 353 353 struct br_mdb_entry entry; 354 354 355 355 memset(&entry, 0, sizeof(entry)); 356 - entry.ifindex = port->dev->ifindex; 356 + if (port) 357 + entry.ifindex = port->dev->ifindex; 358 + else 359 + entry.ifindex = dev->ifindex; 357 360 entry.addr.proto = group->proto; 358 361 entry.addr.u.ip4 = group->u.ip4; 359 362 #if IS_ENABLED(CONFIG_IPV6)
+5 -1
net/bridge/br_multicast.c
··· 250 250 goto out; 251 251 252 252 mp->host_joined = false; 253 + br_mdb_notify(br->dev, NULL, &mp->addr, RTM_DELMDB, 0); 253 254 254 255 if (mp->ports) 255 256 goto out; ··· 774 773 goto err; 775 774 776 775 if (!port) { 777 - mp->host_joined = true; 776 + if (!mp->host_joined) { 777 + mp->host_joined = true; 778 + br_mdb_notify(br->dev, NULL, &mp->addr, RTM_NEWMDB, 0); 779 + } 778 780 mod_timer(&mp->timer, now + br->multicast_membership_interval); 779 781 goto out; 780 782 }