aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-01-22 09:11:04 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:39 -0500
commit3b4bc4a2bfe80d01ebd4f2b6dcc58986c970ed16 (patch)
treed9dea3af7fb8fc828af0ba484c1fc06007dce351 /net
parente31e0bdc7e7fb9a4b09d2f3266c035a18fdcee9d (diff)
[NETNS][FRAGS]: Isolate the secret interval from namespaces.
Since we have one hashtable to lookup the fragment, having different secret_interval-s for hash rebuild doesn't make sense, so move this one to inet_frags. The inet_frags_ctl becomes empty after this, so remove it. The appropriate ctl table is kept read-only in namespaces. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net')
-rw-r--r--net/ipv4/inet_fragment.c4
-rw-r--r--net/ipv4/ip_fragment.c8
-rw-r--r--net/ipv6/netfilter/nf_conntrack_reasm.c6
-rw-r--r--net/ipv6/reassembly.c6
4 files changed, 7 insertions, 17 deletions
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c
index 5ab399c15282..fcf5252166fa 100644
--- a/net/ipv4/inet_fragment.c
+++ b/net/ipv4/inet_fragment.c
@@ -47,7 +47,7 @@ static void inet_frag_secret_rebuild(unsigned long dummy)
47 } 47 }
48 write_unlock(&f->lock); 48 write_unlock(&f->lock);
49 49
50 mod_timer(&f->secret_timer, now + f->ctl->secret_interval); 50 mod_timer(&f->secret_timer, now + f->secret_interval);
51} 51}
52 52
53void inet_frags_init(struct inet_frags *f) 53void inet_frags_init(struct inet_frags *f)
@@ -65,7 +65,7 @@ void inet_frags_init(struct inet_frags *f)
65 65
66 setup_timer(&f->secret_timer, inet_frag_secret_rebuild, 66 setup_timer(&f->secret_timer, inet_frag_secret_rebuild,
67 (unsigned long)f); 67 (unsigned long)f);
68 f->secret_timer.expires = jiffies + f->ctl->secret_interval; 68 f->secret_timer.expires = jiffies + f->secret_interval;
69 add_timer(&f->secret_timer); 69 add_timer(&f->secret_timer);
70} 70}
71EXPORT_SYMBOL(inet_frags_init); 71EXPORT_SYMBOL(inet_frags_init);
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 80c2c19196cd..00646ed451f5 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -74,10 +74,6 @@ struct ipq {
74 struct inet_peer *peer; 74 struct inet_peer *peer;
75}; 75};
76 76
77static struct inet_frags_ctl ip4_frags_ctl __read_mostly = {
78 .secret_interval = 10 * 60 * HZ,
79};
80
81static struct inet_frags ip4_frags; 77static struct inet_frags ip4_frags;
82 78
83int ip_frag_nqueues(struct net *net) 79int ip_frag_nqueues(struct net *net)
@@ -627,7 +623,7 @@ static struct ctl_table ip4_frags_ctl_table[] = {
627 { 623 {
628 .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL, 624 .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL,
629 .procname = "ipfrag_secret_interval", 625 .procname = "ipfrag_secret_interval",
630 .data = &ip4_frags_ctl.secret_interval, 626 .data = &ip4_frags.secret_interval,
631 .maxlen = sizeof(int), 627 .maxlen = sizeof(int),
632 .mode = 0644, 628 .mode = 0644,
633 .proc_handler = &proc_dointvec_jiffies, 629 .proc_handler = &proc_dointvec_jiffies,
@@ -720,7 +716,6 @@ static int ipv4_frags_init_net(struct net *net)
720void __init ipfrag_init(void) 716void __init ipfrag_init(void)
721{ 717{
722 ipv4_frags_init_net(&init_net); 718 ipv4_frags_init_net(&init_net);
723 ip4_frags.ctl = &ip4_frags_ctl;
724 ip4_frags.hashfn = ip4_hashfn; 719 ip4_frags.hashfn = ip4_hashfn;
725 ip4_frags.constructor = ip4_frag_init; 720 ip4_frags.constructor = ip4_frag_init;
726 ip4_frags.destructor = ip4_frag_free; 721 ip4_frags.destructor = ip4_frag_free;
@@ -728,6 +723,7 @@ void __init ipfrag_init(void)
728 ip4_frags.qsize = sizeof(struct ipq); 723 ip4_frags.qsize = sizeof(struct ipq);
729 ip4_frags.match = ip4_frag_match; 724 ip4_frags.match = ip4_frag_match;
730 ip4_frags.frag_expire = ip_expire; 725 ip4_frags.frag_expire = ip_expire;
726 ip4_frags.secret_interval = 10 * 60 * HZ;
731 inet_frags_init(&ip4_frags); 727 inet_frags_init(&ip4_frags);
732} 728}
733 729
diff --git a/net/ipv6/netfilter/nf_conntrack_reasm.c b/net/ipv6/netfilter/nf_conntrack_reasm.c
index c75ac17e3945..6eed991a4a3f 100644
--- a/net/ipv6/netfilter/nf_conntrack_reasm.c
+++ b/net/ipv6/netfilter/nf_conntrack_reasm.c
@@ -70,10 +70,6 @@ struct nf_ct_frag6_queue
70 __u16 nhoffset; 70 __u16 nhoffset;
71}; 71};
72 72
73static struct inet_frags_ctl nf_frags_ctl __read_mostly = {
74 .secret_interval = 10 * 60 * HZ,
75};
76
77static struct inet_frags nf_frags; 73static struct inet_frags nf_frags;
78static struct netns_frags nf_init_frags; 74static struct netns_frags nf_init_frags;
79 75
@@ -701,7 +697,6 @@ int nf_ct_frag6_kfree_frags(struct sk_buff *skb)
701 697
702int nf_ct_frag6_init(void) 698int nf_ct_frag6_init(void)
703{ 699{
704 nf_frags.ctl = &nf_frags_ctl;
705 nf_frags.hashfn = nf_hashfn; 700 nf_frags.hashfn = nf_hashfn;
706 nf_frags.constructor = ip6_frag_init; 701 nf_frags.constructor = ip6_frag_init;
707 nf_frags.destructor = NULL; 702 nf_frags.destructor = NULL;
@@ -709,6 +704,7 @@ int nf_ct_frag6_init(void)
709 nf_frags.qsize = sizeof(struct nf_ct_frag6_queue); 704 nf_frags.qsize = sizeof(struct nf_ct_frag6_queue);
710 nf_frags.match = ip6_frag_match; 705 nf_frags.match = ip6_frag_match;
711 nf_frags.frag_expire = nf_ct_frag6_expire; 706 nf_frags.frag_expire = nf_ct_frag6_expire;
707 nf_frags.secret_interval = 10 * 60 * HZ;
712 nf_init_frags.timeout = IPV6_FRAG_TIMEOUT; 708 nf_init_frags.timeout = IPV6_FRAG_TIMEOUT;
713 nf_init_frags.high_thresh = 256 * 1024; 709 nf_init_frags.high_thresh = 256 * 1024;
714 nf_init_frags.low_thresh = 192 * 1024; 710 nf_init_frags.low_thresh = 192 * 1024;
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c
index 85f3fa382230..852070087307 100644
--- a/net/ipv6/reassembly.c
+++ b/net/ipv6/reassembly.c
@@ -658,7 +658,7 @@ static struct ctl_table ip6_frags_ctl_table[] = {
658 { 658 {
659 .ctl_name = NET_IPV6_IP6FRAG_SECRET_INTERVAL, 659 .ctl_name = NET_IPV6_IP6FRAG_SECRET_INTERVAL,
660 .procname = "ip6frag_secret_interval", 660 .procname = "ip6frag_secret_interval",
661 .data = &init_net.ipv6.sysctl.frags.secret_interval, 661 .data = &ip6_frags.secret_interval,
662 .maxlen = sizeof(int), 662 .maxlen = sizeof(int),
663 .mode = 0644, 663 .mode = 0644,
664 .proc_handler = &proc_dointvec_jiffies, 664 .proc_handler = &proc_dointvec_jiffies,
@@ -719,12 +719,9 @@ static inline void ip6_frags_sysctl_unregister(struct net *net)
719 719
720static int ipv6_frags_init_net(struct net *net) 720static int ipv6_frags_init_net(struct net *net)
721{ 721{
722 ip6_frags.ctl = &net->ipv6.sysctl.frags;
723
724 net->ipv6.frags.high_thresh = 256 * 1024; 722 net->ipv6.frags.high_thresh = 256 * 1024;
725 net->ipv6.frags.low_thresh = 192 * 1024; 723 net->ipv6.frags.low_thresh = 192 * 1024;
726 net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT; 724 net->ipv6.frags.timeout = IPV6_FRAG_TIMEOUT;
727 net->ipv6.sysctl.frags.secret_interval = 10 * 60 * HZ;
728 725
729 inet_frags_init_net(&net->ipv6.frags); 726 inet_frags_init_net(&net->ipv6.frags);
730 727
@@ -748,6 +745,7 @@ int __init ipv6_frag_init(void)
748 ip6_frags.qsize = sizeof(struct frag_queue); 745 ip6_frags.qsize = sizeof(struct frag_queue);
749 ip6_frags.match = ip6_frag_match; 746 ip6_frags.match = ip6_frag_match;
750 ip6_frags.frag_expire = ip6_frag_expire; 747 ip6_frags.frag_expire = ip6_frag_expire;
748 ip6_frags.secret_interval = 10 * 60 * HZ;
751 inet_frags_init(&ip6_frags); 749 inet_frags_init(&ip6_frags);
752out: 750out:
753 return ret; 751 return ret;