]> 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)
commitb80a6e898e4670f42261dce9d3c4c225bef9f090
treeac55e72e4b872999b2c7d33584dd1b023174b24a
parent78775a6ff6172f58cc2e49813d03eea2e501092d
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