mptcp: disallow setting the MPTCP ULP from userspace
Subsystems (3)
Davide Caratti
cover mptcp: disallow setting the MPTCP ULP from userspace
with this series we make
setscokopt(..., IPPROTO_TCP, TCP_ULP, "mptcp", sizeof("mptcp"));
return -1 and set errno to -EOPNOPSUPPORT.
this allows attaching MPTCP ULP only to a TCP socket that has been created through sock_create_kern().
- Patch 1/2 lets subflow_init() fail with -EOPNOTSUPPORT in case users try to setsockopt(..., TCP_ULP) on a TCP socket that has been created by a userspace program. I suggest squashing this patch in "mptcp:
Associate MPTCP context with TCP socket".
- Patch 2/2 includes kselftest code. I suggest squashing it with "mptcp:
add basic kselftest for mptcp".*** SUBJECT HERE ***
Davide Caratti (2):
mptcp: subflow: disallow setsockopt(... TCP_ULP, "mptcp")
selftests: test setsockopt(..., TCP_ULP, "mptcp", ...)
net/mptcp/subflow.c | 7 +++ .../selftests/net/mptcp/mptcp_connect.c | 49 +++++++++++++++++-- .../selftests/net/mptcp/mptcp_connect.sh | 19 +++++++ 3 files changed, 72 insertions(+), 3 deletions(-)
Signature · 1 line
2.21.0
Davide Caratti
PATCH 1/2 mptcp: subflow: disallow setsockopt(... TCP_ULP, "mptcp")
the MPTCP ULP can be attached to a TCP socket only if the socket has been created with sock_create_kern(): ensure that the value of sk->sk_kern_sock is 1 in the MPTCP subflow init() function, and let it return -EOPNOTSUPP otherwise.
--- net/mptcp/subflow.c | 7 +++++++ 1 file changed, 7 insertions(+)
net/mptcp/subflow.c +7 -0
@@ -435,6 +435,13 @@ static int subflow_ulp_init(struct sock *sk)struct tcp_sock *tp =tcp_sk (sk);int err =0 ; +/* disallow attaching ULP to a socket unless it has been +* created with sock_create_kern() +*/ +if (!sk->sk_kern_sock) { + err = -EOPNOTSUPP ; + goto out; + } ctx =subflow_create_ctx (sk, sk->sk_socket,GFP_KERNEL );if (!ctx) { err = -ENOMEM ;
Signature · 1 line
2.21.0
Davide Caratti
PATCH 2/2 selftests: test setsockopt(..., TCP_ULP, "mptcp", ...)
In reply to Davide Carattiadd a selftest to verify that the kernel forbids attaching MPTCP subflows to userspace TCP sockets with setsockopt(..., IPPROTO_TCP, TCP_ULP, ...).
--- .../selftests/net/mptcp/mptcp_connect.c | 49 +++++++++++++++++-- .../selftests/net/mptcp/mptcp_connect.sh | 19 +++++++ 2 files changed, 65 insertions(+), 3 deletions(-)
tools/testing/selftests/net/mptcp/mptcp_connect.c +46 -3
@@ -18,7 +18,8 @@#include <netdb.h> #include <netinet/in.h> -#include <netinet/tcp.h> + +#include <linux/tcp.h> extern int optind;
@@ -32,11 +33,12 @@ static int poll_timeout;static const char *cfg_host;static const char *cfg_port ="12000" ;static int cfg_sock_proto =IPPROTO_MPTCP ; +static bool tcpulp_audit;static void die_usage (void ) { -fprintf (stderr,"Usage: mptcp_connect [-s MPTCP|TCP] [-p port] " +fprintf (stderr,"Usage: mptcp_connect [-u] [-s MPTCP|TCP] [-p port] " "[ -l ] [ -t timeout ] connect_address\n" );exit (1 ); }
@@ -114,6 +116,41 @@ static int sock_listen_mptcp(const char * const listenaddr,return sock; } +static bool sock_test_tcpulp (const char *const remoteaddr, +const char *const port) +{ + +struct addrinfo hints = { + .ai_protocol =IPPROTO_TCP , + .ai_socktype =SOCK_STREAM , + }; +struct addrinfo *a, *addr; +int sock =-1 , ret =0 ; +bool test_pass = false; + + hints.ai_family =AF_INET ; + +xgetaddrinfo (remoteaddr, port, &hints, &addr); +for (a = addr; a; a = a->ai_next) { + sock =socket (a->ai_family, a->ai_socktype,IPPROTO_TCP ); +if (sock <0 ) { +perror ("socket" ); +continue ; + } + + ret =setsockopt (sock,IPPROTO_TCP ,TCP_ULP ,"mptcp" , +sizeof ("mptcp" )); +close (sock); +if (ret ==-1 ) { + test_pass = true; +break ; + } + +perror ("setsockopt(TCP_ULP)" ); + } +return test_pass; +} +static int sock_connect_mptcp (const char *const remoteaddr,const char *const port,int proto) {
@@ -362,7 +399,7 @@ static void parse_opts(int argc, char **argv) {int c; -while ((c =getopt (argc, argv,"lp:s:ht:" )) !=-1 ) { +while ((c =getopt (argc, argv,"lp:s:hut:" )) !=-1 ) {switch (c) {case 'l' : listen_mode = true;
@@ -376,6 +413,9 @@ static void parse_opts(int argc, char **argv)case 'h' :die_usage ();break ; +case 'u' : + tcpulp_audit = true; +break ;case 't' : poll_timeout =atoi (optarg) *1000 ;if (poll_timeout <=0 )
@@ -395,6 +435,9 @@ int main(int argc, char *argv[])parse_opts (argc, argv); +if (tcpulp_audit) +return sock_test_tcpulp (cfg_host, cfg_port) ?0 :1 ; +if (listen_mode) {int fd =sock_listen_mptcp (cfg_host, cfg_port);
tools/testing/selftests/net/mptcp/mptcp_connect.sh +19 -0
@@ -134,6 +134,23 @@ check_mptcp_disabled() return 0 } +check_mptcp_ulp_setsockopt() +{ + local t="ns_ulp" retval= + + ip netns add ${t} || exit $ksft_skip + if ! ip netns exec ${t} ./mptcp_connect -u -p 10000 -s TCP 127.0.0.1 >/dev/null 2>&1; then + printf "setsockopt(..., TCP_ULP, \"mptcp\", ...) allowed\t[ FAIL ]\n" + retval=1 + ret=$retval + else + printf "setsockopt(..., TCP_ULP, \"mptcp\", ...) blocked\t[ OK ]\n" + retval=0 + fi + ip netns del ${t} + return $retval +} + do_ping() { listener_ns="$1"
@@ -271,6 +288,8 @@ make_file "$sin" "server" check_mptcp_disabled +check_mptcp_ulp_setsockopt + for sender in 1 2 3 4;do do_ping ns1 ns$sender 10.0.1.1
Signature · 1 line
2.21.0
Matthieu Baerts
Hi Davide,
Quoted 16 lines · Davide Caratti
with this series we make
setscokopt(..., IPPROTO_TCP, TCP_ULP, "mptcp", sizeof("mptcp"));return -1 and set errno to
-EOPNOPSUPPORT.this allows attaching MPTCP ULP only to a TCP socket that has been created through
sock_create_kern().- Patch 1/2 lets
subflow_init()fail with-EOPNOTSUPPORTin case users try tosetsockopt(..., TCP_ULP)on a TCP socket that has been created by a userspace program. I suggest squashing this patch in "mptcp:
Associate MPTCP context with TCP socket".
- Patch 2/2 includes kselftest code. I suggest squashing it with "mptcp:
add basic kselftest for mptcp".*** SUBJECT HERE ***
Quoted 3 lines
Davide Caratti (2):
mptcp: subflow: disallow setsockopt(...TCP_ULP, "mptcp")
selftests: testsetsockopt(..., TCP_ULP, "mptcp", ...)
Thank you for these two patches!
I just have a few questions, see my answers in my two other emails, nothing blocking!
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
[MPTCP] Re: [PATCH 1/2] mptcp: subflow: disallow setsockopt(... TCP_ULP, "mptcp")
In reply to Davide CarattiHi Davide,
Quoted 15 lines · Davide Caratti
the MPTCP ULP can be attached to a TCP socket only if the socket has been created with
sock_create_kern(): ensure that the value ofsk->sk_kern_sockis 1 in the MPTCP subflowinit()function, and let it return-EOPNOTSUPPotherwise.Signed-off-by Davide Caratti <dcaratti(a)redhat.com>--- net/mptcp/subflow.c | 7 +++++++ 1 file changed, 7 insertions(+)net/mptcp/subflow.c +0
-0
net/mptcp/subflow.c static int subflow_ulp_init(struct sock *sk) · line 444
Quoted 10 lines
net/mptcp/subflow.c +7
-0@@ -435,6 +435,13 @@ static int subflow_ulp_init(struct sock *sk)struct tcp_sock *tp =tcp_sk (sk);int err =0 ; +/* disallow attaching ULP to a socket unless it has been +* created with sock_create_kern() +*/ +if (!sk->sk_kern_sock) { + err = -EOPNOTSUPP ; + goto out; + }
That's good to do that only in MPTCP code!
A very small detail if you have to do a v2: may you add a new line here to separate your new code from the following?
If you don't need a v2 and OK with you, I can add a new line by applying the new patch.
net/mptcp/subflow.c static int subflow_ulp_init(struct sock *sk) · line 447
Quoted 4 lines
net/mptcp/subflow.c +0
-0ctx =subflow_create_ctx (sk, sk->sk_socket,GFP_KERNEL );if (!ctx) { err = -ENOMEM ;
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Matthieu Baerts
[MPTCP] Re: [PATCH 2/2] selftests: test setsockopt(..., TCP_ULP, "mptcp", ...)
In reply to Davide CarattiHi Davide,
Quoted 2 lines · Davide Caratti
add a selftest to verify that the kernel forbids attaching MPTCP subflows to userspace TCP sockets with
setsockopt(..., IPPROTO_TCP, TCP_ULP, ...).
Good idea to have a test for that!
Quoted 10 lines
Signed-off-by Davide Caratti <dcaratti(a)redhat.com>--- .../selftests/net/mptcp/mptcp_connect.c | 49 +++++++++++++++++-- .../selftests/net/mptcp/mptcp_connect.sh | 19 +++++++ 2 files changed, 65 insertions(+), 3 deletions(-)tools/testing/selftests/net/mptcp/mptcp_connect.c +0
-0
[...]
Quoted 13 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +9
-0@@ -114,6 +116,41 @@ static int sock_listen_mptcp(const char * const listenaddr,return sock; } +static bool sock_test_tcpulp (const char *const remoteaddr, +const char *const port) +{ + +struct addrinfo hints = { + .ai_protocol =IPPROTO_TCP , + .ai_socktype =SOCK_STREAM , + }; +struct addrinfo *a, *addr;
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 137
Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +10
-0+int sock =-1 , ret =0 ; +bool test_pass = false; + + hints.ai_family =AF_INET ; + +xgetaddrinfo (remoteaddr, port, &hints, &addr); +for (a = addr; a; a = a->ai_next) { + sock =socket (a->ai_family, a->ai_socktype,IPPROTO_TCP ); +if (sock <0 ) { +perror ("socket" );
Why could we have an error here? It is just to avoid error message in the output for something we don't consider as an error.
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 144
Quoted 7 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +7
-0+continue ; + } + + ret =setsockopt (sock,IPPROTO_TCP ,TCP_ULP ,"mptcp" , +sizeof ("mptcp" )); +close (sock); +if (ret ==-1 ) {
Should we check errno as well? Just to be sure we are not "blocked" for another reason.
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 156
Quoted 12 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +9
-0+ test_pass = true; +break ; + } + +perror ("setsockopt(TCP_ULP)" ); + } +return test_pass; +} +static int sock_connect_mptcp (const char *const remoteaddr,const char *const port,int proto) {
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Mat Martineau
[MPTCP] Re: [PATCH 1/2] mptcp: subflow: disallow setsockopt(... TCP_ULP, "mptcp")
In reply to Davide CarattiQuoted 5 lines · Davide Caratti
the MPTCP ULP can be attached to a TCP socket only if the socket has been created with
sock_create_kern(): ensure that the value ofsk->sk_kern_sockis 1 in the MPTCP subflowinit()function, and let it return-EOPNOTSUPPotherwise.
Looks good to me (with Matthieu's whitespace suggestion). Nice that this method doesn't require ULP infrastructure changes!
Mat
Quoted 29 lines
Signed-off-by Davide Caratti <dcaratti(a)redhat.com>---
net/mptcp/subflow.c| 7 +++++++1 file changed, 7 insertions(+)net/mptcp/subflow.c +7
-0@@ -435,6 +435,13 @@ static int subflow_ulp_init(struct sock *sk)struct tcp_sock *tp =tcp_sk (sk);int err =0 ; +/* disallow attaching ULP to a socket unless it has been +* created with sock_create_kern() +*/ +if (!sk->sk_kern_sock) { + err = -EOPNOTSUPP ; + goto out; + } ctx =subflow_create_ctx (sk, sk->sk_socket,GFP_KERNEL );if (!ctx) { err = -ENOMEM ;Signature · 4 lines
2.21.0 _______________________________________________ mptcp mailing list -- mptcp(a)lists.01.org To unsubscribe send an email to mptcp-leave(a)lists.01.org
--
Mat Martineau
Intel
Paolo Abeni
[MPTCP] Re: [PATCH 2/2] selftests: test setsockopt(..., TCP_ULP, "mptcp", ...)
In reply to Matthieu BaertsQuoted 39 lines · Matthieu Baerts
Hi Davide,
Quoted 2 lines · Davide Caratti
add a selftest to verify that the kernel forbids attaching MPTCP subflows to userspace TCP sockets with
setsockopt(..., IPPROTO_TCP, TCP_ULP, ...).Good idea to have a test for that!
Quoted 10 lines
Signed-off-by Davide Caratti <dcaratti(a)redhat.com>--- .../selftests/net/mptcp/mptcp_connect.c | 49 +++++++++++++++++-- .../selftests/net/mptcp/mptcp_connect.sh | 19 +++++++ 2 files changed, 65 insertions(+), 3 deletions(-)tools/testing/selftests/net/mptcp/mptcp_connect.c +0
-0[...]
Quoted 18 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +14
-0@@ -114,6 +116,41 @@ static int sock_listen_mptcp(const char * const listenaddr,return sock; } +static bool sock_test_tcpulp (const char *const remoteaddr, +const char *const port) +{ + +struct addrinfo hints = { + .ai_protocol =IPPROTO_TCP , + .ai_socktype =SOCK_STREAM , + }; +struct addrinfo *a, *addr; +int sock =-1 , ret =0 ; +bool test_pass = false; + + hints.ai_family =AF_INET ; +
Quoted 8 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 137
Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +5
-0+xgetaddrinfo (remoteaddr, port, &hints, &addr); +for (a = addr; a; a = a->ai_next) { + sock =socket (a->ai_family, a->ai_socktype,IPPROTO_TCP ); +if (sock <0 ) { +perror ("socket" );Why could we have an error here? It is just to avoid error message in the output for something we don't consider as an error.
It can fail e.g. due to memory pressure, or ulimits. Should never happen in normal circumstances, but I think it's better to catch this up, as this patch does.
Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 144
Quoted 7 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +7
-0+continue ; + } + + ret =setsockopt (sock,IPPROTO_TCP ,TCP_ULP ,"mptcp" , +sizeof ("mptcp" )); +close (sock); +if (ret ==-1 ) {Should we check errno as well? Just to be sure we are not "blocked" for another reason.
I agree additionally checking errno == -EOPNOTSUPP would be better.
Otherwise LGTM.
In the longer run we may consider moving this test and ev. diag, MIB, etc to a separate, functional-test binary/script, but I think this is good for now.
Cheers,
Paolo
Matthieu Baerts
[MPTCP] Re: [PATCH 2/2] selftests: test setsockopt(..., TCP_ULP, "mptcp", ...)
Hi Paolo,
Quoted 49 lines · Paolo Abeni
Quoted 39 lines · Matthieu Baerts
Hi Davide,
Quoted 2 lines · Davide Caratti
add a selftest to verify that the kernel forbids attaching MPTCP subflows to userspace TCP sockets with
setsockopt(..., IPPROTO_TCP, TCP_ULP, ...).Good idea to have a test for that!
Quoted 10 lines
Signed-off-by Davide Caratti <dcaratti(a)redhat.com>--- .../selftests/net/mptcp/mptcp_connect.c | 49 +++++++++++++++++-- .../selftests/net/mptcp/mptcp_connect.sh | 19 +++++++ 2 files changed, 65 insertions(+), 3 deletions(-)tools/testing/selftests/net/mptcp/mptcp_connect.c +0
-0[...]
Quoted 18 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +14
-0@@ -114,6 +116,41 @@ static int sock_listen_mptcp(const char * const listenaddr,return sock; } +static bool sock_test_tcpulp (const char *const remoteaddr, +const char *const port) +{ + +struct addrinfo hints = { + .ai_protocol =IPPROTO_TCP , + .ai_socktype =SOCK_STREAM , + }; +struct addrinfo *a, *addr; +int sock =-1 , ret =0 ; +bool test_pass = false; + + hints.ai_family =AF_INET ; +Quoted 8 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 137
Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +5
-0+xgetaddrinfo (remoteaddr, port, &hints, &addr); +for (a = addr; a; a = a->ai_next) { + sock =socket (a->ai_family, a->ai_socktype,IPPROTO_TCP ); +if (sock <0 ) { +perror ("socket" );Why could we have an error here? It is just to avoid error message in the output for something we don't consider as an error.
Quoted 3 lines
It can fail e.g. due to memory pressure, or ulimits. Should never happen in normal circumstances, but I think it's better to catch this up, as this patch does.
Sorry, I should have added my comment at the next line. My question was
also: should we not "break" here in case of error?
But if should never fail, I guess we can still go to the next address. As long as we don't have "useless" error messages each time we execute the tests, I am then fine with both "break" and "continue" here.
Quoted 11 lines
Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 144
Quoted 7 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +7
-0+continue ; + } + + ret =setsockopt (sock,IPPROTO_TCP ,TCP_ULP ,"mptcp" , +sizeof ("mptcp" )); +close (sock); +if (ret ==-1 ) {Should we check errno as well? Just to be sure we are not "blocked" for another reason.
Quoted 7 lines
I agree additionally checking errno ==
-EOPNOTSUPPwould be better.Otherwise LGTM.
In the longer run we may consider moving this test and ev. diag, MIB, etc to a separate, functional-test binary/script, but I think this is good for now.
Good idea, I was thinking about the same thing yesterday. I can have a look at this in the future if needed.
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium
Davide Caratti
[MPTCP] Re: [PATCH 2/2] selftests: test setsockopt(..., TCP_ULP, "mptcp", ...)
Quoted 9 lines · Matthieu Baerts
Hi Paolo,
Quoted 6 lines · Paolo Abeni
Quoted 5 lines · Matthieu Baerts
Hi Davide,
Quoted 2 lines · Davide Caratti
add a selftest to verify that the kernel forbids attaching MPTCP subflows to userspace TCP sockets with
setsockopt(..., IPPROTO_TCP, TCP_ULP, ...).
[...]
Quoted 13 lines
Quoted 9 lines
Quoted 8 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 137
Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +5
-0+xgetaddrinfo (remoteaddr, port, &hints, &addr); +for (a = addr; a; a = a->ai_next) { + sock =socket (a->ai_family, a->ai_socktype,IPPROTO_TCP ); +if (sock <0 ) { +perror ("socket" );Why could we have an error here? It is just to avoid error message in the output for something we don't consider as an error.
Quoted 3 lines
It can fail e.g. due to memory pressure, or ulimits. Should never happen in normal circumstances, but I think it's better to catch this up, as this patch does.
Quoted 5 lines
Sorry, I should have added my comment at the next line. My question was
also: should we not "break" here in case of error?
But if should never fail, I guess we can still go to the next address. As long as we don't have "useless" error messages each time we execute the tests, I am then fine with both "break" and "continue" here.
speaking of this, I see that I redirected the standard error of the test to /dev/null. This makes both "perror()" useless. Unless you object, I will remove redirections from the shellscript.
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 144
Quoted 7 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +7
-0+continue ; + } + + ret =setsockopt (sock,IPPROTO_TCP ,TCP_ULP ,"mptcp" , +sizeof ("mptcp" )); +close (sock); +if (ret ==-1 ) {Should we check errno as well? Just to be sure we are not "blocked" for another reason.
Quoted 1 line
Quoted 1 line
I agree additionally checking errno ==
-EOPNOTSUPPwould be better.
sure, will do that in v2.
Signature · 1 line
davide
Matthieu Baerts
[MPTCP] Re: [PATCH 2/2] selftests: test setsockopt(..., TCP_ULP, "mptcp", ...)
Hi Davide,
Quoted 4 lines · Davide Caratti
Quoted 3 lines · Matthieu Baerts
Quoted 2 lines · Paolo Abeni
Quoted 1 line · Matthieu Baerts
On 08/10/2019 16:43, Davide Caratti wrote:
[...]
Quoted 19 lines
Quoted 13 lines
Quoted 9 lines
Quoted 8 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 137
Quoted 5 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +5
-0+xgetaddrinfo (remoteaddr, port, &hints, &addr); +for (a = addr; a; a = a->ai_next) { + sock =socket (a->ai_family, a->ai_socktype,IPPROTO_TCP ); +if (sock <0 ) { +perror ("socket" );Why could we have an error here? It is just to avoid error message in the output for something we don't consider as an error.
Quoted 3 lines
It can fail e.g. due to memory pressure, or ulimits. Should never happen in normal circumstances, but I think it's better to catch this up, as this patch does.
Quoted 5 lines
Sorry, I should have added my comment at the next line. My question was
also: should we not "break" here in case of error?
But if should never fail, I guess we can still go to the next address. As long as we don't have "useless" error messages each time we execute the tests, I am then fine with both "break" and "continue" here.
Quoted 3 lines
speaking of this, I see that I redirected the standard error of the test to
/dev/null. This makes both "perror()" useless. Unless you object, I will remove redirections from the shellscript.
Good catch and good idea!
Quoted 11 lines
Quoted 11 lines
Quoted 11 lines
Quoted 10 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c static int sock_listen_mptcp(const char * const listenaddr, · line 144
Quoted 7 lines
tools/testing/selftests/net/mptcp/mptcp_connect.c +7
-0+continue ; + } + + ret =setsockopt (sock,IPPROTO_TCP ,TCP_ULP ,"mptcp" , +sizeof ("mptcp" )); +close (sock); +if (ret ==-1 ) {Should we check errno as well? Just to be sure we are not "blocked" for another reason.
Quoted 3 lines
Quoted 1 line
Quoted 1 line
I agree additionally checking errno ==
-EOPNOTSUPPwould be better.sure, will do that in v2.
Thank you!
Cheers,
Matt
Signature · 5 lines
Matthieu Baerts | R&D Engineer matthieu.baerts(a)tessares.net Tessares SA | Hybrid Access Solutions www.tessares.net 1 Avenue Jean Monnet, 1348 Louvain-la-Neuve, Belgium