Subject: Re: [PATCH] tipc: set sk_err correctly when connection fails

From: Paul Gortmaker <[email-masked]>
Date: Tue, 27 Aug 2013 09:20:23 -0400

On 13-08-23 09:56 AM, [email-masked] wrote:
> From: Erik Hugne <[email-masked]>
> 
> This fixes a problem when connect() fails and returns the error
> code as a positive value, whereas errno itself is never set. The
> reason is that error codes set in sk_err should never be inverted.

That seems consistent with the other instances at least.

~/git/linux-head$ git grep ECONNREFUSED net|grep sk_err
net/caif/caif_socket.c:		cf_sk->sk.sk_err = ECONNREFUSED;
net/decnet/dn_nsp_in.c:		sk->sk_err = ECONNREFUSED;
net/ipv4/tcp_input.c:		sk->sk_err = ECONNREFUSED;
net/tipc/socket.c:			sk->sk_err = -ECONNREFUSED;
~/git/linux-head$

What was the high level user visible symptom in this case?
Stalled connections or ... ?

Thanks,
Paul.
--

> 
> Signed-off-by: Erik Hugne <[email-masked]>
> ---
>  net/tipc/socket.c |    4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/net/tipc/socket.c b/net/tipc/socket.c
> index ce8249c..6cc7ddd 100644
> --- a/net/tipc/socket.c
> +++ b/net/tipc/socket.c
> @@ -1257,7 +1257,7 @@ static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf)
>  		/* Accept only ACK or NACK message */
>  		if (unlikely(msg_errcode(msg))) {
>  			sock->state = SS_DISCONNECTING;
> -			sk->sk_err = -ECONNREFUSED;
> +			sk->sk_err = ECONNREFUSED;
>  			retval = TIPC_OK;
>  			break;
>  		}
> @@ -1268,7 +1268,7 @@ static u32 filter_connect(struct tipc_sock *tsock, struct sk_buff **buf)
>  		res = auto_connect(sock, msg);
>  		if (res) {
>  			sock->state = SS_DISCONNECTING;
> -			sk->sk_err = res;
> +			sk->sk_err = -res;
>  			retval = TIPC_OK;
>  			break;
>  		}
> 

------------------------------------------------------------------------------
Introducing Performance Central, a new site from SourceForge and 
AppDynamics. Performance Central is your source for news, insights, 
analysis and resources for efficient Application Performance Management. 
Visit us today!
http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk