summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/net/nettest.c
AgeCommit message (Collapse)Author
2020-01-02nettest: Add support for TCP_MD5 extensionsDavid Ahern
Update nettest to implement TCP_MD5SIG_EXT for a prefix and a device. Add a new option, -m, to specify a prefix and length to use with MD5 auth. The device option comes from the existing -d option. If either are set and MD5 auth is requested, TCP_MD5SIG_EXT is used instead of TCP_MD5SIG. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2020-01-02nettest: Return 1 on MD5 failure for server modeDavid Ahern
On failure to set MD5 password, do_server should return 1 so that the program exits with 1 rather than 255. This used for negative testing when adding MD5 with device option. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-16selftests: Fix get_ifidx and callers in nettest.cDavid Ahern
Dan reported: The patch acda655fefae: "selftests: Add nettest" from Aug 1, 2019, leads to the following static checker warning: ./tools/testing/selftests/net/nettest.c:1690 main() warn: unsigned 'tmp' is never less than zero. ./tools/testing/selftests/net/nettest.c 1680 case '1': 1681 args.has_expected_raddr = 1; 1682 if (convert_addr(&args, optarg, 1683 ADDR_TYPE_EXPECTED_REMOTE)) 1684 return 1; 1685 1686 break; 1687 case '2': 1688 if (str_to_uint(optarg, 0, 0x7ffffff, &tmp) != 0) { 1689 tmp = get_ifidx(optarg); 1690 if (tmp < 0) { "tmp" is unsigned so it can't be negative. Also all the callers assume that get_ifidx() returns negatives on error but it looks like it really returns zero on error so it's a bit unclear to me. Update get_ifidx to return -1 on errors and cleanup callers of it. Fixes: acda655fefae ("selftests: Add nettest") Reported-by: Dan Carpenter <dan.carpenter@oracle.com> Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-05][next] selftests: nettest: fix spelling mistake: "potocol" -> "protocol"Colin Ian King
There is a spelling mistake in an error messgae. Fix it. Signed-off-by: Colin Ian King <colin.king@canonical.com> Acked-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: David S. Miller <davem@davemloft.net>
2019-08-03selftests: Add nettestDavid Ahern
Add nettest - a simple program with an implementation for various networking APIs. nettest is used for tcp, udp and raw functional tests for both IPv4 and IPv6. Point of this command versus existing utilities: - controlled implementation of the APIs and the order in which they are called, - ability to verify ingress device, local and remote addresses, - timeout for controlled test length, - ability to discriminate a timeout from a system call failure, and - simplicity with test scripts. The command returns: 0 on success, 1 for any system call failure, and 2 on timeout. Signed-off-by: David Ahern <dsahern@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>