]> git.hungrycats.org Git - linux/commitdiff
[BRIDGE]: Handle delete of multiple devices with same address.
authorStephen Hemminger <shemminger@osdl.org>
Sat, 22 May 2004 06:36:24 +0000 (23:36 -0700)
committerStephen Hemminger <shemminger@osdl.org>
Sat, 22 May 2004 06:36:24 +0000 (23:36 -0700)
This fixes the issue discovered when removing bluetooth devices from a bridge.
Need to add special case code when forwarding table is being cleaned up to
handle the case where several devices share the same hardware address.

net/bridge/br_fdb.c

index 085a94ceed70a2640cfc299fc8c8ae8d05931a74..067774c55812ca2f0ae4fc0fb9f644ec0cb002a8 100644 (file)
@@ -157,9 +157,28 @@ void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
                hlist_for_each_safe(h, g, &br->hash[i]) {
                        struct net_bridge_fdb_entry *f
                                = hlist_entry(h, struct net_bridge_fdb_entry, hlist);
-                       if (f->dst == p) {
-                               fdb_delete(f);
+                       if (f->dst != p) 
+                               continue;
+
+                       /*
+                        * if multiple ports all have the same device address
+                        * then when one port is deleted, assign
+                        * the local entry to other port
+                        */
+                       if (f->is_local) {
+                               struct net_bridge_port *op;
+                               list_for_each_entry(op, &br->port_list, list) {
+                                       if (op != p && 
+                                           !memcmp(op->dev->dev_addr,
+                                                   f->addr.addr, ETH_ALEN)) {
+                                               f->dst = op;
+                                               goto skip_delete;
+                                       }
+                               }
                        }
+
+                       fdb_delete(f);
+               skip_delete: ;
                }
        }
        write_unlock_bh(&br->hash_lock);