]> bbs.cooldavid.org Git - net-next-2.6.git/blobdiff - net/sctp/protocol.c
[NETNS]: Inet control socket should not hold a namespace.
[net-next-2.6.git] / net / sctp / protocol.c
index beea2fb18b157f5903f5618ccf1952184cc7ede8..067c8a1658d6fbf0872129baeb07ba0f0d7656d6 100644 (file)
@@ -74,7 +74,7 @@ DEFINE_SPINLOCK(sctp_assocs_id_lock);
  * the Out-of-the-blue (OOTB) packets.  A control sock will be created
  * for this socket at the initialization time.
  */
-static struct socket *sctp_ctl_socket;
+static struct sock *sctp_ctl_sock;
 
 static struct sctp_pf *sctp_pf_inet6_specific;
 static struct sctp_pf *sctp_pf_inet_specific;
@@ -91,7 +91,7 @@ int sysctl_sctp_wmem[3];
 /* Return the address of the control sock. */
 struct sock *sctp_get_ctl_sock(void)
 {
-       return sctp_ctl_socket->sk;
+       return sctp_ctl_sock;
 }
 
 /* Set up the proc fs entry for the SCTP protocol. */
@@ -554,7 +554,7 @@ static struct sock *sctp_v4_create_accept_sk(struct sock *sk,
 {
        struct inet_sock *inet = inet_sk(sk);
        struct inet_sock *newinet;
-       struct sock *newsk = sk_alloc(sk->sk_net, PF_INET, GFP_KERNEL,
+       struct sock *newsk = sk_alloc(sock_net(sk), PF_INET, GFP_KERNEL,
                        sk->sk_prot);
 
        if (!newsk)
@@ -630,7 +630,7 @@ static int sctp_inetaddr_event(struct notifier_block *this, unsigned long ev,
        struct sctp_sockaddr_entry *temp;
        int found = 0;
 
-       if (ifa->ifa_dev->dev->nd_net != &init_net)
+       if (dev_net(ifa->ifa_dev->dev) != &init_net)
                return NOTIFY_DONE;
 
        switch (ev) {
@@ -680,16 +680,13 @@ static int sctp_ctl_sock_init(void)
        else
                family = PF_INET;
 
-       err = sock_create_kern(family, SOCK_SEQPACKET, IPPROTO_SCTP,
-                              &sctp_ctl_socket);
+       err = inet_ctl_sock_create(&sctp_ctl_sock, family,
+                                  SOCK_SEQPACKET, IPPROTO_SCTP, &init_net);
        if (err < 0) {
                printk(KERN_ERR
                       "SCTP: Failed to create the SCTP control socket.\n");
                return err;
        }
-       sctp_ctl_socket->sk->sk_allocation = GFP_ATOMIC;
-       inet_sk(sctp_ctl_socket->sk)->uc_ttl = -1;
-
        return 0;
 }
 
@@ -1287,7 +1284,7 @@ err_v6_add_protocol:
        sctp_v6_del_protocol();
 err_add_protocol:
        sctp_v4_del_protocol();
-       sock_release(sctp_ctl_socket);
+       inet_ctl_sock_destroy(sctp_ctl_sock);
 err_ctl_sock_init:
        sctp_v6_protosw_exit();
 err_v6_protosw_init:
@@ -1331,7 +1328,7 @@ SCTP_STATIC __exit void sctp_exit(void)
        sctp_v4_del_protocol();
 
        /* Free the control endpoint.  */
-       sock_release(sctp_ctl_socket);
+       inet_ctl_sock_destroy(sctp_ctl_sock);
 
        /* Free protosw registrations */
        sctp_v6_protosw_exit();