Skip to content

Commit

Permalink
selftests: Set default protocol for raw sockets in nettest
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
David Ahern authored and David S. Miller committed Sep 18, 2020
1 parent 77646b6 commit 897217b
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions tools/testing/selftests/net/nettest.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 897217b

Please sign in to comment.