MPTCP Linux Development
 help / color / mirror / Atom feed
From: Mat Martineau <mathew.j.martineau@linux.intel.com>
To: Florian Westphal <fw@strlen.de>
Cc: mptcp@lists.linux.dev
Subject: Re: [PATCH mptcp-next] selftests: mptcp: add TCP_DEFER test case
Date: Tue, 3 May 2022 14:22:32 -0700 (PDT)	[thread overview]
Message-ID: <403af1b2-b34d-45f-c53-ae2f1e18225@linux.intel.com> (raw)
In-Reply-To: <20220502163641.6146-1-fw@strlen.de>

[-- Attachment #1: Type: text/plain, Size: 2814 bytes --]

On Mon, 2 May 2022, Florian Westphal wrote:

> Check that value x can be set and retrieved.
>

Hi Florian -

I see the same error in this test with both my local test VM and when 
running Matthieu's CI script on a different machine:

# mptcp_sockopt: mptcp_sockopt.c:150: check_tcp_defer: Assertion `rv == value' failed.
# mptcp_sockopt: mptcp_sockopt.c:765: main: Assertion `e1 == 4' failed.
# ./mptcp_sockopt.sh: line 243: 16800 Aborted                 ./mptcp_sockopt
# FAIL: SOL_MPTCP getsockopt
# PASS: TCP_INQ cmsg/ioctl -t tcp
# PASS: TCP_INQ cmsg/ioctl -6 -t tcp
# PASS: TCP_INQ cmsg/ioctl -r tcp
# PASS: TCP_INQ cmsg/ioctl -6 -r tcp
# PASS: TCP_INQ cmsg/ioctl -r tcp -t tcp

I've attached the .config (debug).

- Mat


> Signed-off-by: Florian Westphal <fw@strlen.de>
> ---
> .../selftests/net/mptcp/mptcp_sockopt.c       | 41 ++++++++++++++++++-
> 1 file changed, 39 insertions(+), 2 deletions(-)
>
> diff --git a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> index ac9a4d9c1764..12aa2d921fd5 100644
> --- a/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> +++ b/tools/testing/selftests/net/mptcp/mptcp_sockopt.c
> @@ -133,10 +133,43 @@ static void xgetaddrinfo(const char *node, const char *service,
> 	}
> }
>
> +static void check_tcp_defer(int sock, unsigned int value)
> +{
> +	unsigned int rv;
> +	socklen_t rvl;
> +	int err;
> +
> +	rvl = sizeof(rv);
> +	err = getsockopt(sock, IPPROTO_TCP, TCP_DEFER_ACCEPT, &rv, &rvl);
> +	if (err) {
> +		perror("getsockopt TCP_DEFER_ACCEPT");
> +		exit(1);
> +	}
> +
> +	assert(rvl == (int)sizeof(rv));
> +	assert(rv == value);
> +}
> +
> +static unsigned int set_tcp_defer(int sock)
> +{
> +	unsigned int v = rand();
> +	int err;
> +
> +	v &= 0x1f;
> +
> +	err = setsockopt(sock, IPPROTO_TCP, TCP_DEFER_ACCEPT, &v, sizeof(v));
> +	if (err) {
> +		perror("setsockopt TCP_DEFER_ACCEPT");
> +		exit(1);
> +	}
> +
> +	return v;
> +}
> +
> static int sock_listen_mptcp(const char * const listenaddr,
> 			     const char * const port)
> {
> -	int sock;
> +	int sock, value;
> 	struct addrinfo hints = {
> 		.ai_protocol = IPPROTO_TCP,
> 		.ai_socktype = SOCK_STREAM,
> @@ -173,9 +206,13 @@ static int sock_listen_mptcp(const char * const listenaddr,
> 	if (sock < 0)
> 		xerror("could not create listen socket");
>
> +	value = set_tcp_defer(sock);
> +
> 	if (listen(sock, 20))
> 		die_perror("listen");
>
> +	check_tcp_defer(sock, value);
> +
> 	return sock;
> }
>
> @@ -630,7 +667,7 @@ static void test_ip_tos_sockopt(int fd)
> 	r = getsockopt(fd, SOL_IP, IP_TOS, &tos_out, &s);
> 	if (r != -1 && errno != EINVAL)
> 		die_perror("getsockopt IP_TOS did not indicate -EINVAL");
> -	if (s != -1)
> +	if ((int)s != -1)
> 		xerror("expect socklen_t == -1");
> }
>
> -- 
> 2.35.1
>
>
>

--
Mat Martineau
Intel

[-- Attachment #2: Type: application/x-gzip, Size: 33038 bytes --]

  parent reply	other threads:[~2022-05-03 21:22 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-02 16:36 [PATCH mptcp-next] selftests: mptcp: add TCP_DEFER test case Florian Westphal
2022-05-02 18:14 ` selftests: mptcp: add TCP_DEFER test case: Tests Results MPTCP CI
2022-05-03 21:22 ` Mat Martineau [this message]
2022-05-03 21:32   ` [PATCH mptcp-next] selftests: mptcp: add TCP_DEFER test case Florian Westphal
2022-05-05  0:04     ` Mat Martineau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=403af1b2-b34d-45f-c53-ae2f1e18225@linux.intel.com \
    --to=mathew.j.martineau@linux.intel.com \
    --cc=fw@strlen.de \
    --cc=mptcp@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox