Re: [PATCH v3 net-next 2/5] net: bridge: Send notification when host join/leaves a group

2017-11-07 Thread Florian Fainelli
On 11/06/2017 03:26 PM, Andrew Lunn wrote:
> 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 

Acked-by: Florian Fainelli 
-- 
Florian


Re: [PATCH v3 net-next 2/5] net: bridge: Send notification when host join/leaves a group

2017-11-07 Thread Nikolay Aleksandrov
On  7.11.2017 01:26, Andrew Lunn wrote:
> 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 
> ---
>  net/bridge/br_mdb.c   | 9 ++---
>  net/bridge/br_multicast.c | 6 +-
>  2 files changed, 11 insertions(+), 4 deletions(-)
> 

We really should rewrite __br_mdb_notify to be more readable, but that
is beyond the scope of this set and can be done later.

Acked-by: Nikolay Aleksandrov 



[PATCH v3 net-next 2/5] net: bridge: Send notification when host join/leaves a group

2017-11-06 Thread Andrew Lunn
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 
---
 net/bridge/br_mdb.c   | 9 ++---
 net/bridge/br_multicast.c | 6 +-
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/net/bridge/br_mdb.c b/net/bridge/br_mdb.c
index aa716a33cb71..702408d2a93c 100644
--- a/net/bridge/br_mdb.c
+++ b/net/bridge/br_mdb.c
@@ -317,7 +317,7 @@ static void __br_mdb_notify(struct net_device *dev, struct 
net_bridge_port *p,
 #endif
 
mdb.obj.orig_dev = port_dev;
-   if (port_dev && type == RTM_NEWMDB) {
+   if (p && port_dev && type == RTM_NEWMDB) {
complete_info = kmalloc(sizeof(*complete_info), GFP_ATOMIC);
if (complete_info) {
complete_info->port = p;
@@ -327,7 +327,7 @@ static void __br_mdb_notify(struct net_device *dev, struct 
net_bridge_port *p,
if (switchdev_port_obj_add(port_dev, ))
kfree(complete_info);
}
-   } else if (port_dev && type == RTM_DELMDB) {
+   } else if (p && port_dev && type == RTM_DELMDB) {
switchdev_port_obj_del(port_dev, );
}
 
@@ -353,7 +353,10 @@ void br_mdb_notify(struct net_device *dev, struct 
net_bridge_port *port,
struct br_mdb_entry entry;
 
memset(, 0, sizeof(entry));
-   entry.ifindex = port->dev->ifindex;
+   if (port)
+   entry.ifindex = port->dev->ifindex;
+   else
+   entry.ifindex = dev->ifindex;
entry.addr.proto = group->proto;
entry.addr.u.ip4 = group->u.ip4;
 #if IS_ENABLED(CONFIG_IPV6)
diff --git a/net/bridge/br_multicast.c b/net/bridge/br_multicast.c
index bfe5adb1f51c..cb4729539b82 100644
--- a/net/bridge/br_multicast.c
+++ b/net/bridge/br_multicast.c
@@ -250,6 +250,7 @@ static void br_multicast_group_expired(struct timer_list *t)
goto out;
 
mp->host_joined = false;
+   br_mdb_notify(br->dev, NULL, >addr, RTM_DELMDB, 0);
 
if (mp->ports)
goto out;
@@ -773,7 +774,10 @@ static int br_multicast_add_group(struct net_bridge *br,
goto err;
 
if (!port) {
-   mp->host_joined = true;
+   if (!mp->host_joined) {
+   mp->host_joined = true;
+   br_mdb_notify(br->dev, NULL, >addr, RTM_NEWMDB, 0);
+   }
mod_timer(>timer, now + br->multicast_membership_interval);
goto out;
}
-- 
2.15.0