X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=datapath%2Flinux%2Fcompat%2Finclude%2Flinux%2Fif_vlan.h;h=dc4b15e36e3e33660d27186d9910310c7fe8ae43;hb=3d192f8e5655cbffe50356f46bd8fd8c3e8875b0;hp=f418407487d890feb63910f4893207ac052c04a1;hpb=22bcc0e70becd88bf895c44885d63704affe4284;p=openvswitch diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h index f4184074..dc4b15e3 100644 --- a/datapath/linux/compat/include/linux/if_vlan.h +++ b/datapath/linux/compat/include/linux/if_vlan.h @@ -1,8 +1,9 @@ #ifndef __LINUX_IF_VLAN_WRAPPER_H #define __LINUX_IF_VLAN_WRAPPER_H 1 -#include_next #include +#include +#include_next /* * The behavior of __vlan_put_tag() has changed over time: @@ -30,7 +31,7 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) veth = (struct vlan_ethhdr *)skb_push(skb, VLAN_HLEN); /* Move the mac addresses to the beginning of the new header. */ - memmove(skb->data, skb->data + VLAN_HLEN, 2 * VLAN_ETH_ALEN); + memmove(skb->data, skb->data + VLAN_HLEN, 2 * ETH_ALEN); skb->mac_header -= VLAN_HLEN; /* first, the ethernet type */ @@ -54,4 +55,38 @@ static inline struct sk_buff *__vlan_put_tag(struct sk_buff *skb, u16 vlan_tci) #define VLAN_TAG_PRESENT VLAN_CFI_MASK #endif +#if LINUX_VERSION_CODE < KERNEL_VERSION(3,3,0) +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 #endif /* linux/if_vlan.h wrapper */