Skip to contentSkip to conversation

selftests: Set default protocol for raw sockets in nettest

PATCH Applied David Ahern 2 participants 2 messages Sep 17, 2020 – Sep 18, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 tools/testing/selftests/net/nettest.c | 2 ++
 1 file changed, 2 insertions(+)
tools/testing/selftests/net/nettest.c +2 -0
index 93208caacbe6..f75c53ce0a2d 100644
@@ -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);
Signature · 1 line
2.24.3 (Apple Git-128)
maintainer Applied
#1 lore raw

From: David Ahern <[email protected]>
Date: Thu, 17 Sep 2020 09:13:33 -0600

Quoted 5 lines

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.

Applied, thanks David.