]> err.no Git - linux-2.6/commitdiff
[BRIDGE]: flush forwarding table when device carrier off
authorStephen Hemminger <shemminger@osdl.org>
Thu, 12 Oct 2006 21:45:38 +0000 (14:45 -0700)
committerDavid S. Miller <davem@sunset.davemloft.net>
Mon, 16 Oct 2006 06:14:13 +0000 (23:14 -0700)
Flush the forwarding table when carrier is lost. This helps for
availability because we don't want to forward to a downed device and
new packets may come in on other links.

Signed-off-by: Stephen Hemminger <shemminger@osdl.org>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_fdb.c
net/bridge/br_if.c
net/bridge/br_private.h
net/bridge/br_stp_if.c

index 3a73b8c94271c94beaf3159a078a4fa46c2bb6b0..d9f04864d15d859d0ada8bbb57564999e55eb676 100644 (file)
@@ -128,7 +128,10 @@ void br_fdb_cleanup(unsigned long _data)
        mod_timer(&br->gc_timer, jiffies + HZ/10);
 }
 
-void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
+
+void br_fdb_delete_by_port(struct net_bridge *br,
+                          const struct net_bridge_port *p,
+                          int do_all)
 {
        int i;
 
@@ -142,6 +145,8 @@ void br_fdb_delete_by_port(struct net_bridge *br, struct net_bridge_port *p)
                        if (f->dst != p) 
                                continue;
 
+                       if (f->is_static && !do_all)
+                               continue;
                        /*
                         * if multiple ports all have the same device address
                         * then when one port is deleted, assign
index b1211d5342f6cac5f43926a2c6a39f1651cb6761..f753c40c11d25743d6d13982443b7ebaa1020e38 100644 (file)
@@ -163,7 +163,7 @@ static void del_nbp(struct net_bridge_port *p)
        br_stp_disable_port(p);
        spin_unlock_bh(&br->lock);
 
-       br_fdb_delete_by_port(br, p);
+       br_fdb_delete_by_port(br, p, 1);
 
        list_del_rcu(&p->list);
 
@@ -448,7 +448,7 @@ int br_add_if(struct net_bridge *br, struct net_device *dev)
 
        return 0;
 err2:
-       br_fdb_delete_by_port(br, p);
+       br_fdb_delete_by_port(br, p, 1);
 err1:
        kobject_del(&p->kobj);
 err0:
index c491fb2f280ebf7b1cf2395371c43d33bf36f43c..74258d86f256daf06b1717331026798640820b87 100644 (file)
@@ -143,7 +143,7 @@ extern void br_fdb_changeaddr(struct net_bridge_port *p,
                              const unsigned char *newaddr);
 extern void br_fdb_cleanup(unsigned long arg);
 extern void br_fdb_delete_by_port(struct net_bridge *br,
-                          struct net_bridge_port *p);
+                                 const struct net_bridge_port *p, int do_all);
 extern struct net_bridge_fdb_entry *__br_fdb_get(struct net_bridge *br,
                                                 const unsigned char *addr);
 extern struct net_bridge_fdb_entry *br_fdb_get(struct net_bridge *br,
index 14cd025079af0393abba67e7c3704dc2bd688470..d294224592db0455e0bd31d7f04ab6a290abc21e 100644 (file)
@@ -113,6 +113,8 @@ void br_stp_disable_port(struct net_bridge_port *p)
        del_timer(&p->forward_delay_timer);
        del_timer(&p->hold_timer);
 
+       br_fdb_delete_by_port(br, p, 0);
+
        br_configuration_update(br);
 
        br_port_state_selection(br);