Gitweb:     
http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=467aea0ddfd1f0f1158c57cbef0e8941dd63374c
Commit:     467aea0ddfd1f0f1158c57cbef0e8941dd63374c
Parent:     6229e362dd49b9e8387126bd4483ab0574d23e9c
Author:     Stephen Hemminger <[EMAIL PROTECTED]>
AuthorDate: Wed Mar 21 13:42:06 2007 -0700
Committer:  David S. Miller <[EMAIL PROTECTED]>
CommitDate: Wed Apr 25 22:28:45 2007 -0700

    bridge: don't route packets while learning
    
    While in the STP learning state, don't route packets; wait until
    forwarding delay has expired. The purpose of the forwarding delay
    is to detect loops in the network, and if a brouter started up
    and started forwarding, it could cause a flood.
    
    Signed-off-by: Stephen Hemminger <[EMAIL PROTECTED]>
---
 net/bridge/br_input.c |   17 ++++++++++-------
 1 files changed, 10 insertions(+), 7 deletions(-)

diff --git a/net/bridge/br_input.c b/net/bridge/br_input.c
index 2f5c379..8a55276 100644
--- a/net/bridge/br_input.c
+++ b/net/bridge/br_input.c
@@ -129,7 +129,7 @@ struct sk_buff *br_handle_frame(struct net_bridge_port *p, 
struct sk_buff *skb)
        const unsigned char *dest = eth_hdr(skb)->h_dest;
 
        if (!is_valid_ether_addr(eth_hdr(skb)->h_source))
-               goto err;
+               goto drop;
 
        if (unlikely(is_link_local(dest))) {
                skb->pkt_type = PACKET_HOST;
@@ -138,22 +138,25 @@ struct sk_buff *br_handle_frame(struct net_bridge_port 
*p, struct sk_buff *skb)
                                NULL, br_handle_local_finish) == 0) ? skb : 
NULL;
        }
 
-       if (p->state == BR_STATE_FORWARDING || p->state == BR_STATE_LEARNING) {
+       switch (p->state) {
+       case BR_STATE_FORWARDING:
+
                if (br_should_route_hook) {
                        if (br_should_route_hook(&skb))
                                return skb;
                        dest = eth_hdr(skb)->h_dest;
                }
-
+               /* fall through */
+       case BR_STATE_LEARNING:
                if (!compare_ether_addr(p->br->dev->dev_addr, dest))
                        skb->pkt_type = PACKET_HOST;
 
                NF_HOOK(PF_BRIDGE, NF_BR_PRE_ROUTING, skb, skb->dev, NULL,
                        br_handle_frame_finish);
-               return NULL;
+               break;
+       default:
+drop:
+               kfree_skb(skb);
        }
-
-err:
-       kfree_skb(skb);
        return NULL;
 }
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to