aboutsummaryrefslogtreecommitdiffstats
path: root/net/ipv4/ip_fragment.c
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/ip_fragment.c
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/ip_fragment.c')
-rw-r--r--net/ipv4/ip_fragment.c74
1 files changed, 72 insertions, 2 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;