aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4
diff options
context:
space:
mode:
authorPavel Emelyanov <xemul@openvz.org>2008-01-22 08:58:31 -0500
committerDavid S. Miller <davem@davemloft.net>2008-01-28 18:10:34 -0500
commit8d8354d2fb9277f165715a6e1cb92bcc89259975 (patch)
tree465fd866b6f5b4ab9c05a5441697c07502d0f0ed /net/ipv4
parent9d5c824399dea881779d78a6c147288bf2dccb6b (diff)
[NETNS][FRAGS]: Move ctl tables around.
This is a preparation for sysctl netns-ization. Move the ctl tables to the files, where the tuning variables reside. Plus make the helpers to register the tables. This will simplify the later patches and will keep similar things closer to each other. ipv4, ipv6 and conntrack_reasm are patched differently, but the result is all the tables are in appropriate files. Signed-off-by: Pavel Emelyanov <xemul@openvz.org> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/ipv4')
-rw-r--r--net/ipv4/ip_fragment.c74
-rw-r--r--net/ipv4/sysctl_net_ipv4.c42
2 files changed, 72 insertions, 44 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c
index 2143bf30597a..a53463e594b9 100644
--- a/net/ipv4/ip_fragment.c
+++ b/net/ipv4/ip_fragment.c
@@ -50,7 +50,7 @@
50 * as well. Or notify me, at least. --ANK 50 * as well. Or notify me, at least. --ANK
51 */ 51 */
52 52
53int sysctl_ipfrag_max_dist __read_mostly = 64; 53static int sysctl_ipfrag_max_dist __read_mostly = 64;
54 54
55struct ipfrag_skb_cb 55struct ipfrag_skb_cb
56{ 56{
@@ -74,7 +74,7 @@ struct ipq {
74 struct inet_peer *peer; 74 struct inet_peer *peer;
75}; 75};
76 76
77struct inet_frags_ctl ip4_frags_ctl __read_mostly = { 77static struct inet_frags_ctl ip4_frags_ctl __read_mostly = {
78 /* 78 /*
79 * Fragment cache limits. We will commit 256K at one time. Should we 79 * Fragment cache limits. We will commit 256K at one time. Should we
80 * cross that limit we will prune down to 192K. This should cope with 80 * cross that limit we will prune down to 192K. This should cope with
@@ -607,8 +607,78 @@ int ip_defrag(struct sk_buff *skb, u32 user)
607 return -ENOMEM; 607 return -ENOMEM;
608} 608}
609 609
610#ifdef CONFIG_SYSCTL
611static int zero;
612
613static struct ctl_table ip4_frags_ctl_table[] = {
614 {
615 .ctl_name = NET_IPV4_IPFRAG_HIGH_THRESH,
616 .procname = "ipfrag_high_thresh",
617 .data = &ip4_frags_ctl.high_thresh,
618 .maxlen = sizeof(int),
619 .mode = 0644,
620 .proc_handler = &proc_dointvec
621 },
622 {
623 .ctl_name = NET_IPV4_IPFRAG_LOW_THRESH,
624 .procname = "ipfrag_low_thresh",
625 .data = &ip4_frags_ctl.low_thresh,
626 .maxlen = sizeof(int),
627 .mode = 0644,
628 .proc_handler = &proc_dointvec
629 },
630 {
631 .ctl_name = NET_IPV4_IPFRAG_TIME,
632 .procname = "ipfrag_time",
633 .data = &ip4_frags_ctl.timeout,
634 .maxlen = sizeof(int),
635 .mode = 0644,
636 .proc_handler = &proc_dointvec_jiffies,
637 .strategy = &sysctl_jiffies
638 },
639 {
640 .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL,
641 .procname = "ipfrag_secret_interval",
642 .data = &ip4_frags_ctl.secret_interval,
643 .maxlen = sizeof(int),
644 .mode = 0644,
645 .proc_handler = &proc_dointvec_jiffies,
646 .strategy = &sysctl_jiffies
647 },
648 {
649 .procname = "ipfrag_max_dist",
650 .data = &sysctl_ipfrag_max_dist,
651 .maxlen = sizeof(int),
652 .mode = 0644,
653 .proc_handler = &proc_dointvec_minmax,
654 .extra1 = &zero
655 },
656 { }
657};
658
659static int ip4_frags_ctl_register(struct net *net)
660{
661 struct ctl_table_header *hdr;
662
663 hdr = register_net_sysctl_table(net, net_ipv4_ctl_path,
664 ip4_frags_ctl_table);
665 return hdr == NULL ? -ENOMEM : 0;
666}
667#else
668static inline int ip4_frags_ctl_register(struct net *net)
669{
670 return 0;
671}
672#endif
673
674static int ipv4_frags_init_net(struct net *net)
675{
676 return ip4_frags_ctl_register(net);
677}
678
610void __init ipfrag_init(void) 679void __init ipfrag_init(void)
611{ 680{
681 ipv4_frags_init_net(&init_net);
612 ip4_frags.ctl = &ip4_frags_ctl; 682 ip4_frags.ctl = &ip4_frags_ctl;
613 ip4_frags.hashfn = ip4_hashfn; 683 ip4_frags.hashfn = ip4_hashfn;
614 ip4_frags.constructor = ip4_frag_init; 684 ip4_frags.constructor = ip4_frag_init;
diff --git a/net/ipv4/sysctl_net_ipv4.c b/net/ipv4/sysctl_net_ipv4.c
index 45536a91266a..82cdf23837e3 100644
--- a/net/ipv4/sysctl_net_ipv4.c
+++ b/net/ipv4/sysctl_net_ipv4.c
@@ -284,22 +284,6 @@ static struct ctl_table ipv4_table[] = {
284 .proc_handler = &proc_dointvec 284 .proc_handler = &proc_dointvec
285 }, 285 },
286 { 286 {
287 .ctl_name = NET_IPV4_IPFRAG_HIGH_THRESH,
288 .procname = "ipfrag_high_thresh",
289 .data = &ip4_frags_ctl.high_thresh,
290 .maxlen = sizeof(int),
291 .mode = 0644,
292 .proc_handler = &proc_dointvec
293 },
294 {
295 .ctl_name = NET_IPV4_IPFRAG_LOW_THRESH,
296 .procname = "ipfrag_low_thresh",
297 .data = &ip4_frags_ctl.low_thresh,
298 .maxlen = sizeof(int),
299 .mode = 0644,
300 .proc_handler = &proc_dointvec
301 },
302 {
303 .ctl_name = NET_IPV4_DYNADDR, 287 .ctl_name = NET_IPV4_DYNADDR,
304 .procname = "ip_dynaddr", 288 .procname = "ip_dynaddr",
305 .data = &sysctl_ip_dynaddr, 289 .data = &sysctl_ip_dynaddr,
@@ -308,15 +292,6 @@ static struct ctl_table ipv4_table[] = {
308 .proc_handler = &proc_dointvec 292 .proc_handler = &proc_dointvec
309 }, 293 },
310 { 294 {
311 .ctl_name = NET_IPV4_IPFRAG_TIME,
312 .procname = "ipfrag_time",
313 .data = &ip4_frags_ctl.timeout,
314 .maxlen = sizeof(int),
315 .mode = 0644,
316 .proc_handler = &proc_dointvec_jiffies,
317 .strategy = &sysctl_jiffies
318 },
319 {
320 .ctl_name = NET_IPV4_TCP_KEEPALIVE_TIME, 295 .ctl_name = NET_IPV4_TCP_KEEPALIVE_TIME,
321 .procname = "tcp_keepalive_time", 296 .procname = "tcp_keepalive_time",
322 .data = &sysctl_tcp_keepalive_time, 297 .data = &sysctl_tcp_keepalive_time,
@@ -659,23 +634,6 @@ static struct ctl_table ipv4_table[] = {
659 .proc_handler = &proc_dointvec 634 .proc_handler = &proc_dointvec
660 }, 635 },
661 { 636 {
662 .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL,
663 .procname = "ipfrag_secret_interval",
664 .data = &ip4_frags_ctl.secret_interval,
665 .maxlen = sizeof(int),
666 .mode = 0644,
667 .proc_handler = &proc_dointvec_jiffies,
668 .strategy = &sysctl_jiffies
669 },
670 {
671 .procname = "ipfrag_max_dist",
672 .data = &sysctl_ipfrag_max_dist,
673 .maxlen = sizeof(int),
674 .mode = 0644,
675 .proc_handler = &proc_dointvec_minmax,
676 .extra1 = &zero
677 },
678 {
679 .ctl_name = NET_TCP_NO_METRICS_SAVE, 637 .ctl_name = NET_TCP_NO_METRICS_SAVE,
680 .procname = "tcp_no_metrics_save", 638 .procname = "tcp_no_metrics_save",
681 .data = &sysctl_tcp_nometrics_save, 639 .data = &sysctl_tcp_nometrics_save,