Message ID | 20220927225341.14165-8-dmytro@shytyi.net (mailing list archive) |
---|---|
State | Superseded, archived |
Delegated to: | Paolo Abeni |
Headers | show |
Series | mptcp: Fast Open Mechanism | expand |
Context | Check | Description |
---|---|---|
matttbe/checkpatch | warning | total: 0 errors, 4 warnings, 3 checks, 156 lines checked |
matttbe/build | fail | Build error with: -Werror |
matttbe/KVM_Validation__normal | warning | Unstable: 8 failed test(s): packetdrill_fastopen packetdrill_mp_join packetdrill_mp_prio packetdrill_sockopts packetdrill_syscalls selftest_mptcp_join selftest_mptfo selftest_simult_flows |
matttbe/KVM_Validation__debug | warning | Unstable: 8 failed test(s): packetdrill_fastopen packetdrill_mp_join packetdrill_mp_prio packetdrill_sockopts packetdrill_syscalls selftest_mptcp_join selftest_mptfo selftest_simult_flows |
Hi Dmytro, Thank you for your modifications, that's great! But sadly, our CI spotted some issues with it when trying to build it. You can find more details there: https://patchwork.kernel.org/project/mptcp/patch/20220927225341.14165-8-dmytro@shytyi.net/ https://github.com/multipath-tcp/mptcp_net-next/actions/runs/3139594634 Status: failure Initiator: MPTCPimporter Commits: https://github.com/multipath-tcp/mptcp_net-next/commits/4285eae5e20b Feel free to reply to this email if you cannot access logs, if you need some support to fix the error, if this doesn't seem to be caused by your modifications or if the error is a false positive one. Cheers, MPTCP GH Action bot Bot operated by Matthieu Baerts (Tessares)
Hi Dmytro, Thank you for your modifications, that's great! Our CI did some validations and here is its report: - KVM Validation: normal: - Unstable: 8 failed test(s): packetdrill_fastopen packetdrill_mp_join packetdrill_mp_prio packetdrill_sockopts packetdrill_syscalls selftest_mptcp_join selftest_mptfo selftest_simult_flows
On Tue, 2022-09-27 at 22:53 +0000, Dmytro Shytyi wrote: > MPTFO tests: these are examples of initiator (sendto) and listener, > probably are going to be integrated to the mptcp_connect.* selftests > > Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net> This must be integrated into the current self-tests suite: - update the Makefile to build the helper program (or consider extending the exiting mptcp_connect program instead, adding TCP_FASTOPEN support to the '-o' command line option) - the script must be * listed in the Makefile TEST_PROGS * fully run the tests, executing the client and server program, collecting the result and showing them in a clear way (or consider adding a new section to the mptcp_join.sh script instead, see commit 5ac1d2d6345190907e260daedd980ab3be512cf0 for a relevant example. You would need to use mptcp_connect to do this with a reasonable amount of changes) Additionally we need testcases for both sendmsg(MSG_FASTOPEN) and for setsockopt(TCP_FASTOPEN), possibly in the positive (fastopen is succesful) case and the negative one (switch to plain connect/msg_fastopen fails). /P
Hello, Thank you for this comment. I keep it in my notebook for the moment. I will come back to tests, when I will see the proper result of Initiator and Listener, if you don't mind? Best, Dmytro On 9/28/2022 11:45 AM, Paolo Abeni wrote: > On Tue, 2022-09-27 at 22:53 +0000, Dmytro Shytyi wrote: >> MPTFO tests: these are examples of initiator (sendto) and listener, >> probably are going to be integrated to the mptcp_connect.* selftests >> >> Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net> > This must be integrated into the current self-tests suite: > > - update the Makefile to build the helper program > (or consider extending the exiting mptcp_connect program instead, > adding TCP_FASTOPEN support to the '-o' command line option) > - the script must be > * listed in the Makefile TEST_PROGS > * fully run the tests, executing the client and server program, > collecting the result and showing them in a clear way > (or consider adding a new section to the mptcp_join.sh script > instead, see commit 5ac1d2d6345190907e260daedd980ab3be512cf0 for a > relevant example. You would need to use mptcp_connect to do this with a > reasonable amount of changes) > > Additionally we need testcases for both sendmsg(MSG_FASTOPEN) and for > setsockopt(TCP_FASTOPEN), possibly in the positive (fastopen is > succesful) case and the negative one (switch to plain > connect/msg_fastopen fails). > > /P >
On Sat, 2022-10-01 at 05:03 +0200, Dmytro Shytyi wrote: > Thank you for this comment. I keep it in my notebook for the moment. I > will come back to tests, when I will see the proper result of Initiator > and Listener, if you don't mind? Better self-tests will allow you to more easily validates your patches, and a complete self-test is required for merging. I suggest to not postpone this. Thanks, Paolo p.s. to validate this code, thanks to Mat, there are a few packetdrill available: https://github.com/multipath-tcp/packetdrill/tree/mptcp-net-next/gtests/net/mptcp/fastopen you just need to remote the '.TODO' suffix.
Thank your for response. I started looking at self tests. P.S. Packet drill was also was suggested by Matthieu. On 10/3/2022 10:31 AM, Paolo Abeni wrote: > On Sat, 2022-10-01 at 05:03 +0200, Dmytro Shytyi wrote: >> Thank you for this comment. I keep it in my notebook for the moment. I >> will come back to tests, when I will see the proper result of Initiator >> and Listener, if you don't mind? > Better self-tests will allow you to more easily validates your patches, > and a complete self-test is required for merging. I suggest to not > postpone this. > > Thanks, > > Paolo > > p.s. to validate this code, thanks to Mat, there are a few packetdrill > available: > > https://github.com/multipath-tcp/packetdrill/tree/mptcp-net-next/gtests/net/mptcp/fastopen > > you just need to remote the '.TODO' suffix. > >
diff --git a/tools/testing/selftests/net/mptcp/mptfo.sh b/tools/testing/selftests/net/mptcp/mptfo.sh new file mode 100644 index 000000000000..9ed0cb281094 --- /dev/null +++ b/tools/testing/selftests/net/mptcp/mptfo.sh @@ -0,0 +1,13 @@ +#!/bin/bash +#This is an example of environmen that was used to generate wireshark +sudo ip netns add server +sudo ip netns add client +sudo ip link add veth0 type veth peer name veth1 +sudo ip link set veth1 netns server +sudo ip link set veth0 netns client +sudo ip netns exec client ip a a 10.10.0.1/24 dev veth0 +sudo ip netns exec server ip a a 10.10.0.2/24 dev veth1 +sudo ip netns exec client ip link set dev veth0 up +sudo ip netns exec server ip link set dev veth1 up +sudo ip netns exec server bash -c "echo 2 > /proc/sys/net/ipv4/tcp_fastopen" +sudo ip netns exec client bash -c "echo 1 > /proc/sys/net/ipv4/tcp_fastopen" diff --git a/tools/testing/selftests/net/mptcp/mptfo_initiator.c b/tools/testing/selftests/net/mptcp/mptfo_initiator.c new file mode 100644 index 000000000000..05e6a3d62bb8 --- /dev/null +++ b/tools/testing/selftests/net/mptcp/mptfo_initiator.c @@ -0,0 +1,43 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <arpa/inet.h> +#include <netinet/in.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/socket.h> +#include <unistd.h> +#include <netinet/tcp.h> +#include <string.h> +#include <signal.h> + +#define SERVER_PORT 7003 + +int main(int argc, char *argv[]) +{ + unsigned char valsyn[3] = "abc"; + struct sockaddr_in daddr; + char *valend = "fff"; + char *val1 = "zz1"; + char *val2 = "zz2"; + char *val3 = "zz3"; + int sock_fd = -1; + int ret; + + memset(&daddr, 0, sizeof(daddr)); + inet_pton(AF_INET, "10.10.0.2", &daddr.sin_addr); + daddr.sin_family = AF_INET; + daddr.sin_port = htons(SERVER_PORT); + + sock_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_MPTCP); + + ret = sendto(sock_fd, valsyn, 3, MSG_FASTOPEN, (struct sockaddr *) &daddr, sizeof(daddr)); + ret = write(sock_fd, val1, 3); + ret = write(sock_fd, val2, 3); + ret = write(sock_fd, val2, 3); + ret = write(sock_fd, val2, 3); + ret = write(sock_fd, val3, 3); + ret = write(sock_fd, valend, 3); + + close(sock_fd); + return EXIT_SUCCESS; +} diff --git a/tools/testing/selftests/net/mptcp/mptfo_listener.c b/tools/testing/selftests/net/mptcp/mptfo_listener.c new file mode 100644 index 000000000000..6890349b14bb --- /dev/null +++ b/tools/testing/selftests/net/mptcp/mptfo_listener.c @@ -0,0 +1,100 @@ +// SPDX-License-Identifier: GPL-2.0 + +#include <arpa/inet.h> +#include <stdio.h> +#include <stdlib.h> +#include <sys/socket.h> +#include <sys/types.h> +#include <unistd.h> +#include <netinet/in.h> +#include <linux/in.h> +#include <netinet/tcp.h> + +#define CLIENT_QUEUE_LEN 10 +#define SERVER_PORT 7003 + +int main(void) +{ + int listen_sock_fd = -1, client_sock_fd = -1; + char str_addr[INET6_ADDRSTRLEN]; + struct sockaddr_in server_addr; + int ret, flag; + int qlen = 5; + char ch; + + server_addr.sin_family = AF_INET; + inet_pton(AF_INET, "10.10.0.2", &server_addr.sin_addr); + server_addr.sin_port = htons(SERVER_PORT); + + /* Create socket for listening (client requests) */ + listen_sock_fd = socket(AF_INET, SOCK_STREAM, IPPROTO_MPTCP); + if (listen_sock_fd == -1) { + perror("socket()server"); + return EXIT_FAILURE; + } + + /* Set socket to reuse address */ + flag = 1; + ret = setsockopt(listen_sock_fd, SOL_SOCKET, SO_REUSEADDR, &flag, sizeof(flag)); + if (ret == -1) { + perror("setsockopt()"); + return EXIT_FAILURE; + } + + ret = setsockopt(listen_sock_fd, SOL_TCP, TCP_FASTOPEN, &qlen, sizeof(qlen)); + if (ret == -1) { + perror("setsockopt()TCP_FASTOPEN"); + return EXIT_FAILURE; + } + + /* Bind address and socket together */ + ret = bind(listen_sock_fd, (struct sockaddr *)&server_addr, sizeof(server_addr)); + if (ret == -1) { + perror("bind()"); + close(listen_sock_fd); + return EXIT_FAILURE; + } + + /* Create listening queue (client requests) */ + ret = listen(listen_sock_fd, CLIENT_QUEUE_LEN); + if (ret == -1) { + perror("listen()"); + close(listen_sock_fd); + return EXIT_FAILURE; + } + perror("Server listening"); + while (1) { + /* Do TCP handshake with client */ + client_sock_fd = accept(listen_sock_fd, + NULL, + 0); + if (client_sock_fd == -1) { + perror("accept()"); + close(listen_sock_fd); + return EXIT_FAILURE; + } else { + perror("ACCEPT_SUCCESS"); + } + + char rb[1024]; + + while (1) { + ret = read(client_sock_fd, rb, 3); + + if (ret == -1) { + perror("SERVVERread()"); + close(client_sock_fd); + break; + } else { + fprintf(stderr, "received %c%c%c from client", rb[0], rb[1], rb[2]); + } + if (rb[0] == 'f' && rb[1] == 'f' && rb[2] == 'f') { + close(client_sock_fd); + break; + } + + } + } + + return EXIT_SUCCESS; +}
MPTFO tests: these are examples of initiator (sendto) and listener, probably are going to be integrated to the mptcp_connect.* selftests Signed-off-by: Dmytro Shytyi <dmytro@shytyi.net> --- tools/testing/selftests/net/mptcp/mptfo.sh | 13 +++ .../selftests/net/mptcp/mptfo_initiator.c | 43 ++++++++ .../selftests/net/mptcp/mptfo_listener.c | 100 ++++++++++++++++++ 3 files changed, 156 insertions(+) create mode 100644 tools/testing/selftests/net/mptcp/mptfo.sh create mode 100644 tools/testing/selftests/net/mptcp/mptfo_initiator.c create mode 100644 tools/testing/selftests/net/mptcp/mptfo_listener.c