]> git.baikalelectronics.ru Git - kernel.git/commit
tun: enable napi_gro_frags() for TUN/TAP driver
authorPetar Penkov <peterpenkov96@gmail.com>
Fri, 22 Sep 2017 20:49:15 +0000 (13:49 -0700)
committerDavid S. Miller <davem@davemloft.net>
Tue, 26 Sep 2017 03:16:13 +0000 (20:16 -0700)
commitdbb28a8499aad69f36137cc661efa5cc74761e9c
treeb4052e153b19a3d3341a2f2e67465e4cdaba050d
parent84ce86528b9783e10537d04ad9150d7245403bfe
tun: enable napi_gro_frags() for TUN/TAP driver

Add a TUN/TAP receive mode that exercises the napi_gro_frags()
interface. This mode is available only in TAP mode, as the interface
expects packets with Ethernet headers.

Furthermore, packets follow the layout of the iovec_iter that was
received. The first iovec is the linear data, and every one after the
first is a fragment. If there are more fragments than the max number,
drop the packet. Additionally, invoke eth_get_headlen() to exercise flow
dissector code and to verify that the header resides in the linear data.

The napi_gro_frags() mode requires setting the IFF_NAPI_FRAGS option.
This is imposed because this mode is intended for testing via tools like
syzkaller and packetdrill, and the increased flexibility it provides can
introduce security vulnerabilities. This flag is accepted only if the
device is in TAP mode and has the IFF_NAPI flag set as well. This is
done because both of these are explicit requirements for correct
operation in this mode.

Signed-off-by: Petar Penkov <peterpenkov96@gmail.com>
Cc: Eric Dumazet <edumazet@google.com>
Cc: Mahesh Bandewar <maheshb@google.com>
Cc: Willem de Bruijn <willemb@google.com>
Cc: davem@davemloft.net
Cc: ppenkov@stanford.edu
Acked-by: Mahesh Bandewar <maheshb@google,com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/tun.c
include/uapi/linux/if_tun.h