selftests/net: add ip_defrag selftest
authorPeter Oskolkov <posk@google.com>
Tue, 28 Aug 2018 18:36:20 +0000 (11:36 -0700)
committerDavid S. Miller <davem@davemloft.net>
Thu, 30 Aug 2018 02:49:36 +0000 (19:49 -0700)
commit02c7f38b7ace9f1b2ddb7a88139127eef4cf8706
treeee62cc038df2ba4bf482ad26ed73420e355dd4b6
parent0ff89efb524631ac9901b81446b453c29711c376
selftests/net: add ip_defrag selftest

This test creates a raw IPv4 socket, fragments a largish UDP
datagram and sends the fragments out of order.

Then repeats in a loop with different message and fragment lengths.

Then does the same with overlapping fragments (with overlapping
fragments the expectation is that the recv times out).

Tested:

root@<host># time ./ip_defrag.sh
ipv4 defrag
PASS
ipv4 defrag with overlaps
PASS

real    1m7.679s
user    0m0.628s
sys     0m2.242s

A similar test for IPv6 is to follow.

Signed-off-by: Peter Oskolkov <posk@google.com>
Reviewed-by: Willem de Bruijn <willemb@google.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
tools/testing/selftests/net/.gitignore
tools/testing/selftests/net/Makefile
tools/testing/selftests/net/ip_defrag.c [new file with mode: 0644]
tools/testing/selftests/net/ip_defrag.sh [new file with mode: 0755]