commit 23fd91fff6b4004a3e0e5e7a0b6ca5a97be3d20b Author: Ondrej Mosnacek Date: Tue Feb 6 15:12:39 2024 +0100 WIP diff --git a/tests/inet_socket/client.c b/tests/inet_socket/client.c index d3fedf4..188d8ce 100644 --- a/tests/inet_socket/client.c +++ b/tests/inet_socket/client.c @@ -64,6 +64,9 @@ int main(int argc, char **argv) hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; sockprotocol = IPPROTO_MPTCP; + } else if (!strcmp(argv[optind], "smc")) { + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; } else if (!strcmp(argv[optind], "udp")) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; @@ -79,6 +82,20 @@ int main(int argc, char **argv) exit(2); } + if (!strcmp(argv[optind], "smc")) { + switch (serverinfo->ai_family) { + case AF_INET: + sockprotocol = 0; /* SMC_PROTO_SMC */ + break; + case AF_INET6: + sockprotocol = 1; /* SMC_PROTO_SMC6 */ + break; + default: + usage(argv[0]); + } + serverinfo->ai_family = AF_SMC; + } + sock = socket(serverinfo->ai_family, serverinfo->ai_socktype, sockprotocol); if (sock < 0) { diff --git a/tests/inet_socket/server.c b/tests/inet_socket/server.c index 63b6849..baa3c93 100644 --- a/tests/inet_socket/server.c +++ b/tests/inet_socket/server.c @@ -74,6 +74,10 @@ int main(int argc, char **argv) hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; sockprotocol = IPPROTO_MPTCP; + } else if (!strcmp(argv[optind], "smc")) { + hints.ai_socktype = SOCK_STREAM; + hints.ai_protocol = IPPROTO_TCP; + sockprotocol = 1; /* SMC_PROTO_SMC6 */ } else if (!strcmp(argv[optind], "udp")) { hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; @@ -88,6 +92,9 @@ int main(int argc, char **argv) exit(1); } + if (!strcmp(argv[optind], "smc")) + res->ai_family = AF_SMC; + sock = socket(res->ai_family, res->ai_socktype, sockprotocol); if (sock < 0) { perror("socket"); diff --git a/tests/inet_socket/smc b/tests/inet_socket/smc new file mode 120000 index 0000000..945c9b4 --- /dev/null +++ b/tests/inet_socket/smc @@ -0,0 +1 @@ +. \ No newline at end of file diff --git a/tests/inet_socket/test b/tests/inet_socket/test index 08c7b1d..545988a 100755 --- a/tests/inet_socket/test +++ b/tests/inet_socket/test @@ -8,7 +8,12 @@ BEGIN { chomp($basedir); $proto = basename($basedir); - if ( $proto eq "tcp" or $proto eq "mptcp" ) { + # check if SMC is enabled + if ( $proto eq "smc" and system("modprobe smc 2>/dev/null") != 0 ) { + plan skip_all => "SMC protocol not supported"; + } + + if ( $proto eq "tcp" or $proto eq "mptcp" or $proto eq "smc" ) { $is_stream = 1; $fail_value1 = 5; $fail_value2 = 5;