From: William Tu <u9012...@gmail.com>

Upstream commit:
    commit f192970de860d3ab90aa9e2a22853201a57bde78
    Author: William Tu <u9012...@gmail.com>
    Date:   Thu Oct 5 12:07:12 2017 -0700

    ip_gre: check packet length and mtu correctly in erspan tx

    Similarly to early patch for erspan_xmit(), the ARPHDR_ETHER device
    is the length of the whole ether packet.  So skb->len should subtract
    the dev->hard_header_len.

    Fixes: 1a66a836da63 ("gre: add collect_md mode to ERSPAN tunnel")
    Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
    Signed-off-by: William Tu <u9012...@gmail.com>
    Cc: Xin Long <lucien....@gmail.com>
    Cc: David Laight <david.lai...@aculab.com>
    Reviewed-by: Xin Long <lucien....@gmail.com>
    Signed-off-by: David S. Miller <da...@davemloft.net>

Cc: William Tu <u9012...@gmail.com>
Signed-off-by: Greg Rose <gvrose8...@gmail.com>
---
 datapath/linux/compat/ip_gre.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/datapath/linux/compat/ip_gre.c b/datapath/linux/compat/ip_gre.c
index a5ec59c..77d430e 100644
--- a/datapath/linux/compat/ip_gre.c
+++ b/datapath/linux/compat/ip_gre.c
@@ -996,8 +996,8 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
        if (skb_cow_head(skb, dev->needed_headroom))
                goto free_skb;
 
-       if (skb->len > dev->mtu) {
-               pskb_trim(skb, dev->mtu);
+       if (skb->len > dev->mtu + dev->hard_header_len) {
+               pskb_trim(skb, dev->mtu + dev->hard_header_len);
                truncate = true;
        }
 
-- 
1.8.3.1

_______________________________________________
dev mailing list
d...@openvswitch.org
https://mail.openvswitch.org/mailman/listinfo/ovs-dev

Reply via email to