sctp: sctp should change socket state when shutdown is received
[deliverable/linux.git] / net / sctp / socket.c
index 712fb2339baa24fc0a2e354e8aaea72de8acdc81..6cae4c61ae265746fa7a404b58941d76cc1eecf7 100644 (file)
@@ -4195,6 +4195,7 @@ static void sctp_shutdown(struct sock *sk, int how)
                return;
 
        if (how & SEND_SHUTDOWN) {
+               sk->sk_state = SCTP_SS_CLOSING;
                ep = sctp_sk(sk)->ep;
                if (!list_empty(&ep->asocs)) {
                        asoc = list_entry(ep->asocs.next,
@@ -7566,10 +7567,13 @@ 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;
+       }
 
-       newsk->sk_state = SCTP_SS_ESTABLISHED;
        release_sock(newsk);
 }
 
This page took 0.033936 seconds and 5 git commands to generate.