OSDN Git Service

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)
commit1baf5ebf8954d9bff8fa4e7dd6c416a0cebdb9e2
treeac55e72e4b872999b2c7d33584dd1b023174b24a
parent65245d84a4132988d2e9afbe52d5da8947ed1ced
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