diff options
Diffstat (limited to 'net')
-rw-r--r-- | net/ipv4/ip_fragment.c | 16 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 35 |
2 files changed, 48 insertions, 3 deletions
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 7f102eeb618e..be1cb89a8d5a 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -624,6 +624,10 @@ static struct ctl_table ip4_frags_ns_ctl_table[] = { | |||
624 | .proc_handler = &proc_dointvec_jiffies, | 624 | .proc_handler = &proc_dointvec_jiffies, |
625 | .strategy = &sysctl_jiffies | 625 | .strategy = &sysctl_jiffies |
626 | }, | 626 | }, |
627 | { } | ||
628 | }; | ||
629 | |||
630 | static struct ctl_table ip4_frags_ctl_table[] = { | ||
627 | { | 631 | { |
628 | .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL, | 632 | .ctl_name = NET_IPV4_IPFRAG_SECRET_INTERVAL, |
629 | .procname = "ipfrag_secret_interval", | 633 | .procname = "ipfrag_secret_interval", |
@@ -658,8 +662,6 @@ static int ip4_frags_ns_ctl_register(struct net *net) | |||
658 | table[0].data = &net->ipv4.frags.high_thresh; | 662 | table[0].data = &net->ipv4.frags.high_thresh; |
659 | table[1].data = &net->ipv4.frags.low_thresh; | 663 | table[1].data = &net->ipv4.frags.low_thresh; |
660 | table[2].data = &net->ipv4.frags.timeout; | 664 | table[2].data = &net->ipv4.frags.timeout; |
661 | table[3].mode &= ~0222; | ||
662 | table[4].mode &= ~0222; | ||
663 | } | 665 | } |
664 | 666 | ||
665 | hdr = register_net_sysctl_table(net, net_ipv4_ctl_path, table); | 667 | hdr = register_net_sysctl_table(net, net_ipv4_ctl_path, table); |
@@ -684,6 +686,11 @@ static void ip4_frags_ns_ctl_unregister(struct net *net) | |||
684 | unregister_net_sysctl_table(net->ipv4.frags_hdr); | 686 | unregister_net_sysctl_table(net->ipv4.frags_hdr); |
685 | kfree(table); | 687 | kfree(table); |
686 | } | 688 | } |
689 | |||
690 | static void ip4_frags_ctl_register(void) | ||
691 | { | ||
692 | register_net_sysctl_rotable(net_ipv4_ctl_path, ip4_frags_ctl_table); | ||
693 | } | ||
687 | #else | 694 | #else |
688 | static inline int ip4_frags_ns_ctl_register(struct net *net) | 695 | static inline int ip4_frags_ns_ctl_register(struct net *net) |
689 | { | 696 | { |
@@ -693,6 +700,10 @@ static inline int ip4_frags_ns_ctl_register(struct net *net) | |||
693 | static inline void ip4_frags_ns_ctl_unregister(struct net *net) | 700 | static inline void ip4_frags_ns_ctl_unregister(struct net *net) |
694 | { | 701 | { |
695 | } | 702 | } |
703 | |||
704 | static inline void ip4_frags_ctl_register(void) | ||
705 | { | ||
706 | } | ||
696 | #endif | 707 | #endif |
697 | 708 | ||
698 | static int ipv4_frags_init_net(struct net *net) | 709 | static int ipv4_frags_init_net(struct net *net) |
@@ -730,6 +741,7 @@ static struct pernet_operations ip4_frags_ops = { | |||
730 | 741 | ||
731 | void __init ipfrag_init(void) | 742 | void __init ipfrag_init(void) |
732 | { | 743 | { |
744 | ip4_frags_ctl_register(); | ||
733 | register_pernet_subsys(&ip4_frags_ops); | 745 | register_pernet_subsys(&ip4_frags_ops); |
734 | ip4_frags.hashfn = ip4_hashfn; | 746 | ip4_frags.hashfn = ip4_hashfn; |
735 | ip4_frags.constructor = ip4_frag_init; | 747 | ip4_frags.constructor = ip4_frag_init; |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 130d6f6b6a6e..9391a6949b96 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -658,6 +658,10 @@ static struct ctl_table ip6_frags_ns_ctl_table[] = { | |||
658 | .proc_handler = &proc_dointvec_jiffies, | 658 | .proc_handler = &proc_dointvec_jiffies, |
659 | .strategy = &sysctl_jiffies, | 659 | .strategy = &sysctl_jiffies, |
660 | }, | 660 | }, |
661 | { } | ||
662 | }; | ||
663 | |||
664 | static struct ctl_table ip6_frags_ctl_table[] = { | ||
661 | { | 665 | { |
662 | .ctl_name = NET_IPV6_IP6FRAG_SECRET_INTERVAL, | 666 | .ctl_name = NET_IPV6_IP6FRAG_SECRET_INTERVAL, |
663 | .procname = "ip6frag_secret_interval", | 667 | .procname = "ip6frag_secret_interval", |
@@ -684,7 +688,6 @@ static int ip6_frags_ns_sysctl_register(struct net *net) | |||
684 | table[0].data = &net->ipv6.frags.high_thresh; | 688 | table[0].data = &net->ipv6.frags.high_thresh; |
685 | table[1].data = &net->ipv6.frags.low_thresh; | 689 | table[1].data = &net->ipv6.frags.low_thresh; |
686 | table[2].data = &net->ipv6.frags.timeout; | 690 | table[2].data = &net->ipv6.frags.timeout; |
687 | table[3].mode &= ~0222; | ||
688 | } | 691 | } |
689 | 692 | ||
690 | hdr = register_net_sysctl_table(net, net_ipv6_ctl_path, table); | 693 | hdr = register_net_sysctl_table(net, net_ipv6_ctl_path, table); |
@@ -709,6 +712,20 @@ static void ip6_frags_ns_sysctl_unregister(struct net *net) | |||
709 | unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr); | 712 | unregister_net_sysctl_table(net->ipv6.sysctl.frags_hdr); |
710 | kfree(table); | 713 | kfree(table); |
711 | } | 714 | } |
715 | |||
716 | static struct ctl_table_header *ip6_ctl_header; | ||
717 | |||
718 | static int ip6_frags_sysctl_register(void) | ||
719 | { | ||
720 | ip6_ctl_header = register_net_sysctl_rotable(net_ipv6_ctl_path, | ||
721 | ip6_frags_ctl_table); | ||
722 | return ip6_ctl_header == NULL ? -ENOMEM : 0; | ||
723 | } | ||
724 | |||
725 | static void ip6_frags_sysctl_unregister(void) | ||
726 | { | ||
727 | unregister_net_sysctl_table(ip6_ctl_header); | ||
728 | } | ||
712 | #else | 729 | #else |
713 | static inline int ip6_frags_ns_sysctl_register(struct net *net) | 730 | static inline int ip6_frags_ns_sysctl_register(struct net *net) |
714 | { | 731 | { |
@@ -718,6 +735,15 @@ static inline int ip6_frags_ns_sysctl_register(struct net *net) | |||
718 | static inline void ip6_frags_ns_sysctl_unregister(struct net *net) | 735 | static inline void ip6_frags_ns_sysctl_unregister(struct net *net) |
719 | { | 736 | { |
720 | } | 737 | } |
738 | |||
739 | static inline int ip6_frags_sysctl_register(void) | ||
740 | { | ||
741 | return 0; | ||
742 | } | ||
743 | |||
744 | static inline void ip6_frags_sysctl_unregister(void) | ||
745 | { | ||
746 | } | ||
721 | #endif | 747 | #endif |
722 | 748 | ||
723 | static int ipv6_frags_init_net(struct net *net) | 749 | static int ipv6_frags_init_net(struct net *net) |
@@ -750,6 +776,10 @@ int __init ipv6_frag_init(void) | |||
750 | if (ret) | 776 | if (ret) |
751 | goto out; | 777 | goto out; |
752 | 778 | ||
779 | ret = ip6_frags_sysctl_register(); | ||
780 | if (ret) | ||
781 | goto err_sysctl; | ||
782 | |||
753 | ret = register_pernet_subsys(&ip6_frags_ops); | 783 | ret = register_pernet_subsys(&ip6_frags_ops); |
754 | if (ret) | 784 | if (ret) |
755 | goto err_pernet; | 785 | goto err_pernet; |
@@ -767,6 +797,8 @@ out: | |||
767 | return ret; | 797 | return ret; |
768 | 798 | ||
769 | err_pernet: | 799 | err_pernet: |
800 | ip6_frags_sysctl_unregister(); | ||
801 | err_sysctl: | ||
770 | inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); | 802 | inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); |
771 | goto out; | 803 | goto out; |
772 | } | 804 | } |
@@ -774,6 +806,7 @@ err_pernet: | |||
774 | void ipv6_frag_exit(void) | 806 | void ipv6_frag_exit(void) |
775 | { | 807 | { |
776 | inet_frags_fini(&ip6_frags); | 808 | inet_frags_fini(&ip6_frags); |
809 | ip6_frags_sysctl_unregister(); | ||
777 | unregister_pernet_subsys(&ip6_frags_ops); | 810 | unregister_pernet_subsys(&ip6_frags_ops); |
778 | inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); | 811 | inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); |
779 | } | 812 | } |