[BRIDGE]: Packets leaking out of disabled/blocked ports.
authorStephen Hemminger <shemminger@linux-foundation.org>
Fri, 31 Aug 2007 05:15:35 +0000 (22:15 -0700)
committerDavid S. Miller <davem@davemloft.net>
Fri, 31 Aug 2007 05:15:35 +0000 (22:15 -0700)
This patch fixes some packet leakage in bridge.  The bridging code was
allowing forward table entries to be generated even if a device was
being blocked. The fix is to not add forwarding database entries
unless the port is active.

The bug arose as part of the conversion to processing STP frames
through normal receive path (in 2.6.17).

Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org>
Acked-by: John W. Linville <linville@tuxdriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_fdb.c
net/bridge/br_input.c

index 69b70977f00061610b30fc86475e167bf49f4ee0..eb57502bb2641b7087b50a8c2577699f3b3ab388 100644 (file)
@@ -384,6 +384,11 @@ void br_fdb_update(struct net_bridge *br, struct net_bridge_port *source,
        if (hold_time(br) == 0)
                return;
 
+       /* ignore packets unless we are using this port */
+       if (!(source->state == BR_STATE_LEARNING ||
+             source->state == BR_STATE_FORWARDING))
+               return;
+
        fdb = fdb_find(head, addr);
        if (likely(fdb)) {
                /* attempt to update an entry for a local interface */
index 5c18595b7616602b7f987b80be7f3ce403617549..6f468fc3357a08f9c04bcbf4b22d93004521b3ac 100644 (file)
@@ -101,9 +101,8 @@ static int br_handle_local_finish(struct sk_buff *skb)
 {
        struct net_bridge_port *p = rcu_dereference(skb->dev->br_port);
 
-       if (p && p->state != BR_STATE_DISABLED)
+       if (p)
                br_fdb_update(p->br, p, eth_hdr(skb)->h_source);
-
        return 0;        /* process further */
 }