Skip to content

Commit

Permalink
net: Fix missing meta data in skb with vlan packet
Browse files Browse the repository at this point in the history
skb_reorder_vlan_header() should move XDP meta data with ethernet header
if XDP meta data exists.

Fixes: de8f3a8 ("bpf: add meta pointer for direct access")
Signed-off-by: Yuya Kusakabe <[email protected]>
Signed-off-by: Takeru Hayasaka <[email protected]>
Co-developed-by: Takeru Hayasaka <[email protected]>
Reviewed-by: Toshiaki Makita <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
  • Loading branch information
higebu authored and davem330 committed Apr 17, 2019
1 parent 899537b commit d85e8be
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion net/core/skbuff.c
Original file line number Diff line number Diff line change
Expand Up @@ -5083,7 +5083,8 @@ EXPORT_SYMBOL_GPL(skb_gso_validate_mac_len);

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) {
kfree_skb(skb);
Expand All @@ -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),
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;
return skb;
}
Expand Down

0 comments on commit d85e8be

Please sign in to comment.