summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Ahern <dsahern@kernel.org>2020-09-17 18:13:33 +0300
committerDavid S. Miller <davem@davemloft.net>2020-09-18 03:07:15 +0300
commit897217b9a00426a037215c5539f467733a3823fe (patch)
treee08a59cef08639b5d0f30d753b51861d9965547e
parent77646b63ff2513dfe256d9dbf0929221f083369e (diff)
downloadlinux-897217b9a00426a037215c5539f467733a3823fe.tar.xz
selftests: Set default protocol for raw sockets in nettest
IPPROTO_IP (0) is not valid for raw sockets. Default the protocol for raw sockets to IPPROTO_RAW if the protocol has not been set via the -P option. Signed-off-by: David Ahern <dsahern@kernel.org> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--tools/testing/selftests/net/nettest.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/tools/testing/selftests/net/nettest.c b/tools/testing/selftests/net/nettest.c
index 93208caacbe6..f75c53ce0a2d 100644
--- a/tools/testing/selftests/net/nettest.c
+++ b/tools/testing/selftests/net/nettest.c
@@ -1667,6 +1667,8 @@ int main(int argc, char *argv[])
case 'R':
args.type = SOCK_RAW;
args.port = 0;
+ if (!args.protocol)
+ args.protocol = IPPROTO_RAW;
break;
case 'P':
pe = getprotobyname(optarg);