diff options
author | Xin Long <lucien.xin@gmail.com> | 2017-10-01 10:00:54 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-10-02 01:30:32 -0400 |
commit | 5513d08d29511c263c00933c00dd7a82fffda3c9 (patch) | |
tree | 45892f8a4f18640551475f209b5d4aaad7c02966 | |
parent | 935a9749a36828af0e8be224a5cd4bc758112c34 (diff) |
ip_gre: check packet length and mtu correctly in erspan_xmit
As a ARPHRD_ETHER device, skb->len in erspan_xmit is the length
of the whole ether packet. So before checking if a packet size
exceeds the mtu, skb->len should subtract dev->hard_header_len.
Otherwise, all packets with max size according to mtu would be
trimmed to be truncated packet.
Fixes: 84e54fe0a5ea ("gre: introduce native tunnel support for ERSPAN")
Signed-off-by: Xin Long <lucien.xin@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | net/ipv4/ip_gre.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/net/ipv4/ip_gre.c b/net/ipv4/ip_gre.c index b25b1e5112d0..2a4ef9dc48ff 100644 --- a/net/ipv4/ip_gre.c +++ b/net/ipv4/ip_gre.c | |||
@@ -731,7 +731,7 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb, | |||
731 | if (skb_cow_head(skb, dev->needed_headroom)) | 731 | if (skb_cow_head(skb, dev->needed_headroom)) |
732 | goto free_skb; | 732 | goto free_skb; |
733 | 733 | ||
734 | if (skb->len > dev->mtu) { | 734 | if (skb->len - dev->hard_header_len > dev->mtu) { |
735 | pskb_trim(skb, dev->mtu); | 735 | pskb_trim(skb, dev->mtu); |
736 | truncate = true; | 736 | truncate = true; |
737 | } | 737 | } |