]> git.baikalelectronics.ru Git - kernel.git/commit
erspan: auto detect truncated packets.
authorWilliam Tu <u9012063@gmail.com>
Fri, 27 Apr 2018 21:16:32 +0000 (14:16 -0700)
committerDavid S. Miller <davem@davemloft.net>
Mon, 30 Apr 2018 15:43:45 +0000 (11:43 -0400)
commitb22ab0cbe042f2518c3fe1ef1be0c00029be76a6
treeac55e72e4b872999b2c7d33584dd1b023174b24a
parentb364e9531f62c69c437ba11931bf7dd5728c75bd
erspan: auto detect truncated packets.

Currently the truncated bit is set only when the mirrored packet
is larger than mtu.  For certain cases, the packet might already
been truncated before sending to the erspan tunnel.  In this case,
the patch detect whether the IP header's total length is larger
than the actual skb->len.  If true, this indicated that the
mirrored packet is truncated and set the erspan truncate bit.

I tested the patch using bpf_skb_change_tail helper function to
shrink the packet size and send to erspan tunnel.

Reported-by: Xiaoyan Jin <xiaoyanj@vmware.com>
Signed-off-by: William Tu <u9012063@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/ipv4/ip_gre.c
net/ipv6/ip6_gre.c