sctp: sctp should change socket state when shutdown is received
[deliverable/linux.git] / net / sctp / socket.c
index 67154b848aa9bae93ce2bc6941e7974acb678142..6cae4c61ae265746fa7a404b58941d76cc1eecf7 100644 (file)
@@ -4003,6 +4003,8 @@ static int sctp_init_sock(struct sock *sk)
                return -ESOCKTNOSUPPORT;
        }
 
+       sk->sk_gso_type = SKB_GSO_SCTP;
+
        /* Initialize default send parameters. These parameters can be
         * modified with the SCTP_DEFAULT_SEND_PARAM socket option.
         */
@@ -4193,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,
@@ -7564,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.028006 seconds and 5 git commands to generate.