diff options
author | David S. Miller <davem@davemloft.net> | 2011-12-03 22:53:31 -0500 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-12-03 22:53:31 -0500 |
commit | 78a8a36fe0b2cee5a0a7360107815cbcad5b4003 (patch) | |
tree | 1abf45fa898ed4e31a131328b0e182f29a72300a /include/linux/if_vlan.h | |
parent | 04a6f4417bfd17c3860e8fb37387cb78265ffe44 (diff) | |
parent | ccb1352e76cff0524e7ccb2074826a092dd13016 (diff) | |
download | lwn-78a8a36fe0b2cee5a0a7360107815cbcad5b4003.tar.gz lwn-78a8a36fe0b2cee5a0a7360107815cbcad5b4003.zip |
Merge branch 'for-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/jesse/openvswitch
Diffstat (limited to 'include/linux/if_vlan.h')
-rw-r--r-- | include/linux/if_vlan.h | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/include/linux/if_vlan.h b/include/linux/if_vlan.h index 12d5543b14f2..070ac50c1d2d 100644 --- a/include/linux/if_vlan.h +++ b/include/linux/if_vlan.h @@ -310,6 +310,40 @@ static inline __be16 vlan_get_protocol(const struct sk_buff *skb) return protocol; } + +static inline void vlan_set_encap_proto(struct sk_buff *skb, + struct vlan_hdr *vhdr) +{ + __be16 proto; + unsigned char *rawp; + + /* + * Was a VLAN packet, grab the encapsulated protocol, which the layer + * three protocols care about. + */ + + proto = vhdr->h_vlan_encapsulated_proto; + if (ntohs(proto) >= 1536) { + skb->protocol = proto; + return; + } + + rawp = skb->data; + if (*(unsigned short *) rawp == 0xFFFF) + /* + * This is a magic hack to spot IPX packets. Older Novell + * breaks the protocol design and runs IPX over 802.3 without + * an 802.2 LLC layer. We look for FFFF which isn't a used + * 802.2 SSAP/DSAP. This won't work for fault tolerant netware + * but does for the rest. + */ + skb->protocol = htons(ETH_P_802_3); + else + /* + * Real 802.2 LLC + */ + skb->protocol = htons(ETH_P_802_2); +} #endif /* __KERNEL__ */ /* VLAN IOCTLs are found in sockios.h */ |