All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH net-next] selftests: Set default protocol for raw sockets in nettest
@ 2020-09-17 15:13 David Ahern
  2020-09-18  0:07 ` David Miller
  0 siblings, 1 reply; 2+ messages in thread
From: David Ahern @ 2020-09-17 15:13 UTC (permalink / raw)
  To: netdev; +Cc: davem, kuba, David Ahern

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>
---
 tools/testing/selftests/net/nettest.c | 2 ++
 1 file changed, 2 insertions(+)

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);
-- 
2.24.3 (Apple Git-128)


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH net-next] selftests: Set default protocol for raw sockets in nettest
  2020-09-17 15:13 [PATCH net-next] selftests: Set default protocol for raw sockets in nettest David Ahern
@ 2020-09-18  0:07 ` David Miller
  0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2020-09-18  0:07 UTC (permalink / raw)
  To: dsahern; +Cc: netdev, kuba

From: David Ahern <dsahern@kernel.org>
Date: Thu, 17 Sep 2020 09:13:33 -0600

> 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>

Applied, thanks David.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-09-18  0:07 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-17 15:13 [PATCH net-next] selftests: Set default protocol for raw sockets in nettest David Ahern
2020-09-18  0:07 ` David Miller

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.