netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] net: Fix missing meta data in skb with vlan packet
@ 2019-04-13 12:16 Yuya Kusakabe
  2019-04-15  6:05 ` Toshiaki Makita
  0 siblings, 1 reply; 14+ messages in thread
From: Yuya Kusakabe @ 2019-04-13 12:16 UTC (permalink / raw)
  To: davem; +Cc: taketarou2, netdev

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

Signed-off-by: Yuya Kusakabe <yuya.kusakabe@gmail.com>
Signed-off-by: Takeru Hayasaka <taketarou2@gmail.com>
Co-developed-by: Takeru Hayasaka <taketarou2@gmail.com>
---
 net/core/skbuff.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/net/core/skbuff.c b/net/core/skbuff.c
index ef2cd5712098..6bc663249c4c 100644
--- a/net/core/skbuff.c
+++ b/net/core/skbuff.c
@@ -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);
@@ -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;
 }
--
2.20.1

^ permalink raw reply related	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2019-04-17  4:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-04-13 12:16 [PATCH] net: Fix missing meta data in skb with vlan packet Yuya Kusakabe
2019-04-15  6:05 ` Toshiaki Makita
2019-04-15  8:06   ` Yuya Kusakabe
2019-04-15  9:48     ` Toshiaki Makita
2019-04-15 14:21       ` [PATCH v2] " Yuya Kusakabe
2019-04-16  0:45         ` Toshiaki Makita
2019-04-16  1:17           ` Yuya Kusakabe
2019-04-16  1:22             ` [PATCH v3] " Yuya Kusakabe
2019-04-16  4:14               ` Toshiaki Makita
2019-04-17  4:30               ` David Miller
     [not found]   ` <CAGCJULPCzSc4E8vmQQkYqdQeLVXTv-Gpi-v0f+AF89bHH7GXDA@mail.gmail.com>
2019-04-15  8:07     ` [PATCH] " Toshiaki Makita
2019-04-15  8:28       ` Yuya Kusakabe
2019-04-15  9:57   ` Jesper Dangaard Brouer
2019-04-15 10:13     ` Toshiaki Makita

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).