net: bridge: check port state before br_allowed_egress
authorNikolay Aleksandrov <nikolay@cumulusnetworks.com>
Fri, 24 Jan 2020 11:40:19 +0000 (13:40 +0200)
committerDavid S. Miller <davem@davemloft.net>
Fri, 24 Jan 2020 11:58:14 +0000 (12:58 +0100)
If we make sure that br_allowed_egress is called only when we have
BR_STATE_FORWARDING state then we can avoid a test later when we add
per-vlan state.

Signed-off-by: Nikolay Aleksandrov <nikolay@cumulusnetworks.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/bridge/br_forward.c

index 86637000f275dbb44e3d6abc073ec254f1708480..7629b63f6f3033b98a649c1c24073e992cb3a541 100644 (file)
@@ -25,7 +25,7 @@ static inline int should_deliver(const struct net_bridge_port *p,
 
        vg = nbp_vlan_group_rcu(p);
        return ((p->flags & BR_HAIRPIN_MODE) || skb->dev != p->dev) &&
-               br_allowed_egress(vg, skb) && p->state == BR_STATE_FORWARDING &&
+               p->state == BR_STATE_FORWARDING && br_allowed_egress(vg, skb) &&
                nbp_switchdev_allowed_egress(p, skb) &&
                !br_skb_isolated(p, skb);
 }