Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net
[linux-2.6-block.git] / net / ipv4 / af_inet.c
index a5aa54ea6533638390286b4e0ffe05b9c5b802b0..9532ee87151f5d184205eafc70729fc543a9eb82 100644 (file)
@@ -319,7 +319,7 @@ lookup_protocol:
        WARN_ON(!answer_prot->slab);
 
        err = -ENOBUFS;
-       sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot);
+       sk = sk_alloc(net, PF_INET, GFP_KERNEL, answer_prot, kern);
        if (!sk)
                goto out;
 
@@ -490,7 +490,8 @@ int inet_bind(struct socket *sock, struct sockaddr *uaddr, int addr_len)
                inet->inet_saddr = 0;  /* Use device */
 
        /* Make sure we are allowed to bind here. */
-       if (sk->sk_prot->get_port(sk, snum)) {
+       if ((snum || !inet->bind_address_no_port) &&
+           sk->sk_prot->get_port(sk, snum)) {
                inet->inet_saddr = inet->inet_rcv_saddr = 0;
                err = -EADDRINUSE;
                goto out_release_sock;
@@ -1432,7 +1433,7 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family,
                         struct net *net)
 {
        struct socket *sock;
-       int rc = sock_create_kern(family, type, protocol, &sock);
+       int rc = sock_create_kern(net, family, type, protocol, &sock);
 
        if (rc == 0) {
                *sk = sock->sk;
@@ -1442,8 +1443,6 @@ int inet_ctl_sock_create(struct sock **sk, unsigned short family,
                 * we do not wish this socket to see incoming packets.
                 */
                (*sk)->sk_prot->unhash(*sk);
-
-               sk_change_net(*sk, net);
        }
        return rc;
 }
@@ -1599,7 +1598,7 @@ static __net_init int inet_init_net(struct net *net)
         */
        seqlock_init(&net->ipv4.ip_local_ports.lock);
        net->ipv4.ip_local_ports.range[0] =  32768;
-       net->ipv4.ip_local_ports.range[1] =  61000;
+       net->ipv4.ip_local_ports.range[1] =  60999;
 
        seqlock_init(&net->ipv4.ping_group_range.lock);
        /*