bridge: mdb: fill state in br_mdb_notify
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Thu, 9 Jul 2015 10:11:10 +0000 (03:11 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 10 Jul 2015 04:41:11 +0000 (21:41 -0700)
Fill also the port group state when sending notifications.

Signed-off-by: Satish Ashok <sashok@cumulusnetworks.com>
Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_mdb.c
net/bridge/br_multicast.c
net/bridge/br_private.h

index e29ad70b3000be4f0e7486b172746ea62b4f216f..1fb7d076f15c383e6ddddfbca33cfb66f9b77f20 100644 (file)
@@ -230,7 +230,7 @@ errout:
 }
 
 void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
-                  struct br_ip *group, int type)
+                  struct br_ip *group, int type, u8 state)
 {
        struct br_mdb_entry entry;
 
@@ -241,6 +241,7 @@ void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
 #if IS_ENABLED(CONFIG_IPV6)
        entry.addr.u.ip6 = group->u.ip6;
 #endif
+       entry.state = state;
        __br_mdb_notify(dev, &entry, type);
 }
 
@@ -348,7 +349,7 @@ static int br_mdb_add_group(struct net_bridge *br, struct net_bridge_port *port,
                return -ENOMEM;
        rcu_assign_pointer(*pp, p);
 
-       br_mdb_notify(br->dev, port, group, RTM_NEWMDB);
+       br_mdb_notify(br->dev, port, group, RTM_NEWMDB, state);
        return 0;
 }
 
index 742a6c27d7a222bc3c53c288b4a6915194310fe6..5a44cd9473f2e03506f809f817f5b6904c6314a7 100644 (file)
@@ -694,7 +694,7 @@ static int br_multicast_add_group(struct net_bridge *br,
        if (unlikely(!p))
                goto err;
        rcu_assign_pointer(*pp, p);
-       br_mdb_notify(br->dev, port, group, RTM_NEWMDB);
+       br_mdb_notify(br->dev, port, group, RTM_NEWMDB, MDB_TEMPORARY);
 
 found:
        mod_timer(&p->timer, now + br->multicast_membership_interval);
@@ -1439,8 +1439,9 @@ br_multicast_leave_group(struct net_bridge *br,
                        rcu_assign_pointer(*pp, p->next);
                        hlist_del_init(&p->mglist);
                        del_timer(&p->timer);
+                       br_mdb_notify(br->dev, port, group, RTM_DELMDB,
+                                     p->state);
                        call_rcu_bh(&p->rcu, br_multicast_free_pg);
-                       br_mdb_notify(br->dev, port, group, RTM_DELMDB);
 
                        if (!mp->ports && !mp->mglist &&
                            netif_running(br->dev))
index 8b21146b24a055652be0c7d74fd875ed875da918..c73fd785654da3e2284c3a4f07ed769aaed344af 100644 (file)
@@ -488,7 +488,7 @@ br_multicast_new_port_group(struct net_bridge_port *port, struct br_ip *group,
 void br_mdb_init(void);
 void br_mdb_uninit(void);
 void br_mdb_notify(struct net_device *dev, struct net_bridge_port *port,
-                  struct br_ip *group, int type);
+                  struct br_ip *group, int type, u8 state);
 
 #define mlock_dereference(X, br) \
        rcu_dereference_protected(X, lockdep_is_held(&br->multicast_lock))