History

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.

Petar Penkov committed 9 years ago

Commit 90e33d41 parent 94317092 files · +129 −6Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/if_tun.h+1−0
@@ -61,6 +61,7 @@ · 60 unmodified lines
6161 #define IFF_TUN 0x0001
6262 #define IFF_TAP 0x0002
6363 #define IFF_NAPI 0x0010
64+#define IFF_NAPI_FRAGS 0x0020
6465 #define IFF_NO_PI 0x1000
6566 /* This flag has no real effect */
6667 #define IFF_ONE_QUEUE 0x2000