aboutsummaryrefslogtreecommitdiffstats
path: root/net/bridge/br_vlan.c
diff options
context:
space:
mode:
authorVlad Yasevich <vyasevic@redhat.com>2013-02-13 07:00:11 -0500
committerDavid S. Miller <davem@davemloft.net>2013-02-13 19:41:46 -0500
commit85f46c6baef1486ce20e13dd7cdea5dd15be2a90 (patch)
treeaab52d4f01320337bfc59358d26fc856e717a8f2 /net/bridge/br_vlan.c
parenta37b85c9fbd1dc69fbec3985763f373203eaf9e3 (diff)
bridge: Verify that a vlan is allowed to egress on given port
When bridge forwards a frame, make sure that a frame is allowed to egress on that port. Signed-off-by: Vlad Yasevich <vyasevic@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/bridge/br_vlan.c')
-rw-r--r--net/bridge/br_vlan.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/net/bridge/br_vlan.c b/net/bridge/br_vlan.c
index 8b4bcd8ff46e..d8690bfe63d4 100644
--- a/net/bridge/br_vlan.c
+++ b/net/bridge/br_vlan.c
@@ -89,6 +89,26 @@ bool br_allowed_ingress(struct net_bridge *br, struct net_port_vlans *v,
89 return false; 89 return false;
90} 90}
91 91
92/* Called under RCU. */
93bool br_allowed_egress(struct net_bridge *br,
94 const struct net_port_vlans *v,
95 const struct sk_buff *skb)
96{
97 u16 vid;
98
99 if (!br->vlan_enabled)
100 return true;
101
102 if (!v)
103 return false;
104
105 br_vlan_get_tag(skb, &vid);
106 if (test_bit(vid, v->vlan_bitmap))
107 return true;
108
109 return false;
110}
111
92/* Must be protected by RTNL */ 112/* Must be protected by RTNL */
93int br_vlan_add(struct net_bridge *br, u16 vid) 113int br_vlan_add(struct net_bridge *br, u16 vid)
94{ 114{