diff mbox series

[mptcp-net] mptcp: fix joined subflows with unblocking sk

Message ID 20200727083857.3137824-1-matthieu.baerts@tessares.net
State Accepted, archived
Delegated to: Matthieu Baerts
Headers show
Series [mptcp-net] mptcp: fix joined subflows with unblocking sk | expand

Commit Message

Matthieu Baerts July 27, 2020, 8:38 a.m. UTC
Unblocking sockets used for outgoing connections were not containing
inet info about the initial connection due to a typo there: the value of
"err" variable is negative in the kernelspace.

This fixes the creation of additional subflows where the remote port has
to be reused if the other host didn't announce another one. This also
fixes inet_diag showing blank info about MPTCP sockets from unblocking
sockets doing a connect().

Fixes: 41be81a8d3d0 ("mptcp: fix unblocking connect()")
Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
---
 net/mptcp/protocol.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Paolo Abeni July 27, 2020, 8:59 a.m. UTC | #1
On Mon, 2020-07-27 at 10:38 +0200, Matthieu Baerts wrote:
> Unblocking sockets used for outgoing connections were not containing
> inet info about the initial connection due to a typo there: the value of
> "err" variable is negative in the kernelspace.
> 
> This fixes the creation of additional subflows where the remote port has
> to be reused if the other host didn't announce another one. This also
> fixes inet_diag showing blank info about MPTCP sockets from unblocking
> sockets doing a connect().
> 
> Fixes: 41be81a8d3d0 ("mptcp: fix unblocking connect()")
> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
> ---
>  net/mptcp/protocol.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
> index 3980fbb6f31e..c0abe738e7d3 100644
> --- a/net/mptcp/protocol.c
> +++ b/net/mptcp/protocol.c
> @@ -1833,7 +1833,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
>  	/* on successful connect, the msk state will be moved to established by
>  	 * subflow_finish_connect()
>  	 */
> -	if (!err || err == EINPROGRESS)
> +	if (!err || err == -EINPROGRESS)
>  		mptcp_copy_inaddrs(sock->sk, ssock->sk);
>  	else
>  		inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk));

LGTM! thanks for fixing my bugs :)

Feel free to go upstream ASAP ;)

Thanks,

Paolo
Matthieu Baerts July 27, 2020, 10:26 a.m. UTC | #2
Hi Paolo,

On 27/07/2020 10:59, Paolo Abeni wrote:
> On Mon, 2020-07-27 at 10:38 +0200, Matthieu Baerts wrote:
>> Unblocking sockets used for outgoing connections were not containing
>> inet info about the initial connection due to a typo there: the value of
>> "err" variable is negative in the kernelspace.
>>
>> This fixes the creation of additional subflows where the remote port has
>> to be reused if the other host didn't announce another one. This also
>> fixes inet_diag showing blank info about MPTCP sockets from unblocking
>> sockets doing a connect().
>>
>> Fixes: 41be81a8d3d0 ("mptcp: fix unblocking connect()")
>> Signed-off-by: Matthieu Baerts <matthieu.baerts@tessares.net>
>> ---
>>   net/mptcp/protocol.c | 2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
>> index 3980fbb6f31e..c0abe738e7d3 100644
>> --- a/net/mptcp/protocol.c
>> +++ b/net/mptcp/protocol.c
>> @@ -1833,7 +1833,7 @@ static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
>>   	/* on successful connect, the msk state will be moved to established by
>>   	 * subflow_finish_connect()
>>   	 */
>> -	if (!err || err == EINPROGRESS)
>> +	if (!err || err == -EINPROGRESS)
>>   		mptcp_copy_inaddrs(sock->sk, ssock->sk);
>>   	else
>>   		inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk));
> 
> LGTM! thanks for fixing my bugs :)
> 
> Feel free to go upstream ASAP ;)

Thank you for the quick review!

I just added this patch in the export branch:

- 3a0ff6c990db: mptcp: fix joined subflows with unblocking sk
- 4297750f3218..b5d8e98a4a38: result

I also just sent it to netdev ML, to be applied in -net.

Cheers,
Matt
diff mbox series

Patch

diff --git a/net/mptcp/protocol.c b/net/mptcp/protocol.c
index 3980fbb6f31e..c0abe738e7d3 100644
--- a/net/mptcp/protocol.c
+++ b/net/mptcp/protocol.c
@@ -1833,7 +1833,7 @@  static int mptcp_stream_connect(struct socket *sock, struct sockaddr *uaddr,
 	/* on successful connect, the msk state will be moved to established by
 	 * subflow_finish_connect()
 	 */
-	if (!err || err == EINPROGRESS)
+	if (!err || err == -EINPROGRESS)
 		mptcp_copy_inaddrs(sock->sk, ssock->sk);
 	else
 		inet_sk_state_store(sock->sk, inet_sk_state_load(ssock->sk));