Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 222040
b: refs/heads/master
c: 0a85df0
h: refs/heads/master
v: v3
  • Loading branch information
Hao Zheng authored and David S. Miller committed Nov 12, 2010
1 parent fd8abc9 commit 81d3e8c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 167c25e4c5501f8b7e37f949d23652975c5a769c
refs/heads/master: 0a85df004667c99efc31fab07386823eefce3be5
25 changes: 25 additions & 0 deletions trunk/include/linux/if_vlan.h
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,31 @@ static inline int vlan_get_tag(const struct sk_buff *skb, u16 *vlan_tci)
}
}

/**
* vlan_get_protocol - get protocol EtherType.
* @skb: skbuff to query
*
* Returns the EtherType of the packet, regardless of whether it is
* vlan encapsulated (normal or hardware accelerated) or not.
*/
static inline __be16 vlan_get_protocol(const struct sk_buff *skb)
{
__be16 protocol = 0;

if (vlan_tx_tag_present(skb) ||
skb->protocol != cpu_to_be16(ETH_P_8021Q))
protocol = skb->protocol;
else {
__be16 proto, *protop;
protop = skb_header_pointer(skb, offsetof(struct vlan_ethhdr,
h_vlan_encapsulated_proto),
sizeof(proto), &proto);
if (likely(protop))
protocol = *protop;
}

return protocol;
}
#endif /* __KERNEL__ */

/* VLAN IOCTLs are found in sockios.h */
Expand Down

0 comments on commit 81d3e8c

Please sign in to comment.