]> err.no Git - linux-2.6/blobdiff - net/ipv6/af_inet6.c
[NETNS][IPV6]: Make ip6_frags per namespace.
[linux-2.6] / net / ipv6 / af_inet6.c
index 34c20533ba5d972bf3d8adf7384a5a51075e0261..c4a1882fa80f929b062a9a0f70050f23c24d7773 100644 (file)
@@ -66,14 +66,14 @@ MODULE_AUTHOR("Cast of dozens");
 MODULE_DESCRIPTION("IPv6 protocol stack for Linux");
 MODULE_LICENSE("GPL");
 
-int sysctl_ipv6_bindv6only __read_mostly;
-
 /* The inetsw6 table contains everything that inet6_create needs to
  * build a new socket.
  */
 static struct list_head inetsw6[SOCK_MAX];
 static DEFINE_SPINLOCK(inetsw6_lock);
 
+void ipv6_frag_sysctl_init(struct net *net);
+
 static __inline__ struct ipv6_pinfo *inet6_sk_generic(struct sock *sk)
 {
        const int offset = sk->sk_prot->obj_size - sizeof(struct ipv6_pinfo);
@@ -193,7 +193,7 @@ lookup_protocol:
        np->mcast_hops  = -1;
        np->mc_loop     = 1;
        np->pmtudisc    = IPV6_PMTUDISC_WANT;
-       np->ipv6only    = sysctl_ipv6_bindv6only;
+       np->ipv6only    = init_net.ipv6.sysctl.bindv6only;
 
        /* Init the ipv4 part of the socket since we can have sockets
         * using v6 API for ipv4.
@@ -719,6 +719,28 @@ static void cleanup_ipv6_mibs(void)
        snmp_mib_free((void **)udplite_stats_in6);
 }
 
+static int inet6_net_init(struct net *net)
+{
+       net->ipv6.sysctl.bindv6only = 0;
+       net->ipv6.sysctl.frags.high_thresh = 256 * 1024;
+       net->ipv6.sysctl.frags.low_thresh = 192 * 1024;
+       net->ipv6.sysctl.frags.timeout = IPV6_FRAG_TIMEOUT;
+       net->ipv6.sysctl.frags.secret_interval = 10 * 60 * HZ;
+       ipv6_frag_sysctl_init(net);
+
+       return 0;
+}
+
+static void inet6_net_exit(struct net *net)
+{
+       return;
+}
+
+static struct pernet_operations inet6_net_ops = {
+       .init = inet6_net_init,
+       .exit = inet6_net_exit,
+};
+
 static int __init inet6_init(void)
 {
        struct sk_buff *dummy_skb;
@@ -782,8 +804,14 @@ static int __init inet6_init(void)
         *      able to communicate via both network protocols.
         */
 
+       err = register_pernet_subsys(&inet6_net_ops);
+       if (err)
+               goto register_pernet_fail;
+
 #ifdef CONFIG_SYSCTL
-       ipv6_sysctl_register();
+       err = ipv6_sysctl_register();
+       if (err)
+               goto sysctl_fail;
 #endif
        err = icmpv6_init(&inet6_family_ops);
        if (err)
@@ -897,7 +925,10 @@ ndisc_fail:
 icmp_fail:
 #ifdef CONFIG_SYSCTL
        ipv6_sysctl_unregister();
+sysctl_fail:
 #endif
+       unregister_pernet_subsys(&inet6_net_ops);
+register_pernet_fail:
        cleanup_ipv6_mibs();
 out_unregister_sock:
        sock_unregister(PF_INET6);
@@ -953,6 +984,7 @@ static void __exit inet6_exit(void)
 #ifdef CONFIG_SYSCTL
        ipv6_sysctl_unregister();
 #endif
+       unregister_pernet_subsys(&inet6_net_ops);
        cleanup_ipv6_mibs();
        proto_unregister(&rawv6_prot);
        proto_unregister(&udplitev6_prot);