Commit d85e8be2 authored by Yuya Kusakabe's avatar Yuya Kusakabe Committed by David S. Miller

net: Fix missing meta data in skb with vlan packet

skb_reorder_vlan_header() should move XDP meta data with ethernet header
if XDP meta data exists.

Fixes: de8f3a83 ("bpf: add meta pointer for direct access")
Signed-off-by: default avatarYuya Kusakabe <yuya.kusakabe@gmail.com>
Signed-off-by: default avatarTakeru Hayasaka <taketarou2@gmail.com>
Co-developed-by: default avatarTakeru Hayasaka <taketarou2@gmail.com>
Reviewed-by: default avatarToshiaki Makita <makita.toshiaki@lab.ntt.co.jp>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 899537b7
...@@ -5083,7 +5083,8 @@ EXPORT_SYMBOL_GPL(skb_gso_validate_mac_len); ...@@ -5083,7 +5083,8 @@ EXPORT_SYMBOL_GPL(skb_gso_validate_mac_len);
static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb) static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
{ {
int mac_len; int mac_len, meta_len;
void *meta;
if (skb_cow(skb, skb_headroom(skb)) < 0) { if (skb_cow(skb, skb_headroom(skb)) < 0) {
kfree_skb(skb); kfree_skb(skb);
...@@ -5095,6 +5096,13 @@ static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb) ...@@ -5095,6 +5096,13 @@ static struct sk_buff *skb_reorder_vlan_header(struct sk_buff *skb)
memmove(skb_mac_header(skb) + VLAN_HLEN, skb_mac_header(skb), memmove(skb_mac_header(skb) + VLAN_HLEN, skb_mac_header(skb),
mac_len - VLAN_HLEN - ETH_TLEN); mac_len - VLAN_HLEN - ETH_TLEN);
} }
meta_len = skb_metadata_len(skb);
if (meta_len) {
meta = skb_metadata_end(skb) - meta_len;
memmove(meta + VLAN_HLEN, meta, meta_len);
}
skb->mac_header += VLAN_HLEN; skb->mac_header += VLAN_HLEN;
return skb; return skb;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment