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 <[email protected]>
[...]
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