[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <ce5d05f9-3700-1007-2253-2ccaa00e6064@cogentembedded.com>
Date: Thu, 9 Jun 2016 16:42:47 +0300
From: Sergei Shtylyov <sergei.shtylyov@...entembedded.com>
To: Xin Long <lucien.xin@...il.com>,
network dev <netdev@...r.kernel.org>,
linux-sctp@...r.kernel.org
Cc: Marcelo Ricardo Leitner <marcelo.leitner@...il.com>,
Vlad Yasevich <vyasevich@...il.com>, daniel@...earbox.net,
davem@...emloft.net, eric.dumazet@...il.com
Subject: Re: [PATCHv3 net-next] sctp: sctp should change socket state when
shutdown is received
Hello.
On 6/9/2016 2:22 PM, Xin Long wrote:
> Now sctp doesn't change socket state upon shutdown reception. It changes
> just the assoc state, even though it's a TCP-style socket.
>
> For some cases, if we really need to check sk->sk_state, it's necessary to
> fix this issue, at least when we use ss or netstat to dump, we can get a
> more exact information.
>
> As an improvement, we will change sk->sk_state when we change asoc->state
> to SHUTDOWN_RECEIVED, and also do it in sctp_shutdown to keep consistent with
> sctp_close.
>
> Signed-off-by: Xin Long <lucien.xin@...il.com>
[...]
> diff --git a/net/sctp/socket.c b/net/sctp/socket.c
> index 67154b8..80d860a 100644
> --- a/net/sctp/socket.c
> +++ b/net/sctp/socket.c
[...]
> @@ -7564,10 +7565,12 @@ static void sctp_sock_migrate(struct sock *oldsk, struct sock *newsk,
> /* If the association on the newsk is already closed before accept()
> * is called, set RCV_SHUTDOWN flag.
> */
> - if (sctp_state(assoc, CLOSED) && sctp_style(newsk, TCP))
> + if (sctp_state(assoc, CLOSED) && sctp_style(newsk, TCP)) {
> + newsk->sk_state = SCTP_SS_CLOSING;
> newsk->sk_shutdown |= RCV_SHUTDOWN;
> + } else
> + newsk->sk_state = SCTP_SS_ESTABLISHED;
CodingStyle: all arms of the *if* statment should use {} if at least one
arm uses {}.
MBR, Sergei
Powered by blists - more mailing lists