]> err.no Git - linux-2.6/blobdiff - net/ipv6/ipv6_sockglue.c
[IPV6]: Simplify IPv6 control sockets creation.
[linux-2.6] / net / ipv6 / ipv6_sockglue.c
index d3d93d752e1099c43cfa1e33adfa15630463df7f..4195ac92345e84f6a060fee53fa0d0274df36471 100644 (file)
@@ -155,10 +155,11 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
 
                        if (sk->sk_protocol == IPPROTO_TCP) {
                                struct inet_connection_sock *icsk = inet_csk(sk);
+                               struct net *net = sock_net(sk);
 
                                local_bh_disable();
-                               sock_prot_inuse_add(sk->sk_prot, -1);
-                               sock_prot_inuse_add(&tcp_prot, 1);
+                               sock_prot_inuse_add(net, sk->sk_prot, -1);
+                               sock_prot_inuse_add(net, &tcp_prot, 1);
                                local_bh_enable();
                                sk->sk_prot = &tcp_prot;
                                icsk->icsk_af_ops = &ipv4_specific;
@@ -167,12 +168,13 @@ static int do_ipv6_setsockopt(struct sock *sk, int level, int optname,
                                tcp_sync_mss(sk, icsk->icsk_pmtu_cookie);
                        } else {
                                struct proto *prot = &udp_prot;
+                               struct net *net = sock_net(sk);
 
                                if (sk->sk_protocol == IPPROTO_UDPLITE)
                                        prot = &udplite_prot;
                                local_bh_disable();
-                               sock_prot_inuse_add(sk->sk_prot, -1);
-                               sock_prot_inuse_add(prot, 1);
+                               sock_prot_inuse_add(net, sk->sk_prot, -1);
+                               sock_prot_inuse_add(net, prot, 1);
                                local_bh_enable();
                                sk->sk_prot = prot;
                                sk->sk_socket->ops = &inet_dgram_ops;