X-Git-Url: http://git.cascardo.eti.br/?a=blobdiff_plain;f=datapath%2Flinux%2Fcompat%2Finclude%2Flinux%2Fif_vlan.h;h=28c4daeba9e5cd2370bcd32fb37cc90e256a09aa;hb=17e3889fd18078784ad8e49c12ba2806b49c5b53;hp=616b3bf8a2b703f0a426ed71e8bf6e9a36b5f1d2;hpb=1f649f1c8d4e86e0b28baf1a9508f3ed09bd3d34;p=cascardo%2Fovs.git diff --git a/datapath/linux/compat/include/linux/if_vlan.h b/datapath/linux/compat/include/linux/if_vlan.h index 616b3bf8a..28c4daeba 100644 --- a/datapath/linux/compat/include/linux/if_vlan.h +++ b/datapath/linux/compat/include/linux/if_vlan.h @@ -106,4 +106,33 @@ static inline void vlan_set_encap_proto(struct sk_buff *skb, struct vlan_hdr *vh skb->protocol = htons(ETH_P_802_2); } #endif + +#ifndef HAVE___VLAN_INSERT_TAG +/* Kernels which don't have __vlan_insert_tag() also don't have skb->vlan_proto + * so ignore the proto paramter. + */ +#define __vlan_insert_tag(skb, proto, tci) rpl_vlan_insert_tag(skb, tci) +static inline int rpl_vlan_insert_tag(struct sk_buff *skb, u16 vlan_tci) +{ + struct vlan_ethhdr *veth; + + if (skb_cow_head(skb, VLAN_HLEN) < 0) + return -ENOMEM; + + 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 * ETH_ALEN); + skb->mac_header -= VLAN_HLEN; + + /* first, the ethernet type */ + veth->h_vlan_proto = htons(ETH_P_8021Q); + + /* now, the TCI */ + veth->h_vlan_TCI = htons(ETH_P_8021Q); + + return 0; +} +#endif + #endif /* linux/if_vlan.h wrapper */