Re: [PATCH net-next V4 03/13] bridge: Validate that vlan is permitted on ingress
From: Cong Wang <hidden>
Date: 2012-12-20 07:27:25
From: Cong Wang <hidden>
Date: 2012-12-20 07:27:25
On Wed, 19 Dec 2012 at 17:48 GMT, Vlad Yasevich [off-list ref] wrote:
+static inline u16 br_get_vlan(const struct sk_buff *skb)
+{
+ u16 tag;
+
+ if (vlan_tx_tag_present(skb))
+ return vlan_tx_tag_get(skb) & VLAN_VID_MASK;
+
+ if (vlan_get_tag(skb, &tag))
+ return 0;
+
+ return tag & VLAN_VID_MASK;
+}
+Nitpick: The name br_get_vlan() can easily confuse people with br_vlan_find(). Also, this function looks like not bridge-specific, how about moving it to if_vlan.h?