Skip to content
Snippets Groups Projects
socket.c 172 KiB
Newer Older
  • Learn to ignore specific revisions
  • 		sctp_skb_set_owner_r_frag(skb, newsk);
    	}
    
    	sctp_skb_for_each(skb, &assoc->ulpq.lobby, tmp) {
    		sctp_sock_rfree_frag(skb);
    		sctp_skb_set_owner_r_frag(skb, newsk);
    	}
    
    
    Linus Torvalds's avatar
    Linus Torvalds committed
    	/* Set the type of socket to indicate that it is peeled off from the
    	 * original UDP-style socket or created with the accept() call on a
    	 * TCP-style socket..
    	 */
    	newsp->type = type;
    
    
    	/* Mark the new socket "in-use" by the user so that any packets
    	 * that may arrive on the association after we've moved it are
    	 * queued to the backlog.  This prevents a potential race between
    	 * backlog processing on the old socket and new-packet processing
    	 * on the new socket.
    	 */
    	sctp_lock_sock(newsk);
    
    Linus Torvalds's avatar
    Linus Torvalds committed
    	sctp_assoc_migrate(assoc, 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))
    		newsk->sk_shutdown |= RCV_SHUTDOWN;
    
    	newsk->sk_state = SCTP_SS_ESTABLISHED;
    
    Linus Torvalds's avatar
    Linus Torvalds committed
    }
    
    /* This proto struct describes the ULP interface for SCTP.  */
    struct proto sctp_prot = {
    	.name        =	"SCTP",
    	.owner       =	THIS_MODULE,
    	.close       =	sctp_close,
    	.connect     =	sctp_connect,
    	.disconnect  =	sctp_disconnect,
    	.accept      =	sctp_accept,
    	.ioctl       =	sctp_ioctl,
    	.init        =	sctp_init_sock,
    	.destroy     =	sctp_destroy_sock,
    	.shutdown    =	sctp_shutdown,
    	.setsockopt  =	sctp_setsockopt,
    	.getsockopt  =	sctp_getsockopt,
    	.sendmsg     =	sctp_sendmsg,
    	.recvmsg     =	sctp_recvmsg,
    	.bind        =	sctp_bind,
    	.backlog_rcv =	sctp_backlog_rcv,
    	.hash        =	sctp_hash,
    	.unhash      =	sctp_unhash,
    	.get_port    =	sctp_get_port,
    	.obj_size    =  sizeof(struct sctp_sock),
    };
    
    #if defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE)
    struct proto sctpv6_prot = {
    	.name		= "SCTPv6",
    	.owner		= THIS_MODULE,
    	.close		= sctp_close,
    	.connect	= sctp_connect,
    	.disconnect	= sctp_disconnect,
    	.accept		= sctp_accept,
    	.ioctl		= sctp_ioctl,
    	.init		= sctp_init_sock,
    	.destroy	= sctp_destroy_sock,
    	.shutdown	= sctp_shutdown,
    	.setsockopt	= sctp_setsockopt,
    	.getsockopt	= sctp_getsockopt,
    	.sendmsg	= sctp_sendmsg,
    	.recvmsg	= sctp_recvmsg,
    	.bind		= sctp_bind,
    	.backlog_rcv	= sctp_backlog_rcv,
    	.hash		= sctp_hash,
    	.unhash		= sctp_unhash,
    	.get_port	= sctp_get_port,
    	.obj_size	= sizeof(struct sctp6_sock),
    };
    #endif /* defined(CONFIG_IPV6) || defined(CONFIG_IPV6_MODULE) */