Skip to content

Commit 5513d08

Browse files
lxindavem330
authored andcommitted
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: 84e54fe ("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>
1 parent 935a974 commit 5513d08

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

net/ipv4/ip_gre.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -731,7 +731,7 @@ static netdev_tx_t erspan_xmit(struct sk_buff *skb,
731731
if (skb_cow_head(skb, dev->needed_headroom))
732732
goto free_skb;
733733

734-
if (skb->len > dev->mtu) {
734+
if (skb->len - dev->hard_header_len > dev->mtu) {
735735
pskb_trim(skb, dev->mtu);
736736
truncate = true;
737737
}

0 commit comments

Comments
 (0)