diff options
-rw-r--r-- | include/net/inet_frag.h | 1 | ||||
-rw-r--r-- | net/ipv4/inet_fragment.c | 7 | ||||
-rw-r--r-- | net/ipv4/ip_fragment.c | 13 | ||||
-rw-r--r-- | net/ipv6/reassembly.c | 14 |
4 files changed, 33 insertions, 2 deletions
diff --git a/include/net/inet_frag.h b/include/net/inet_frag.h index 3695ff4cfe63..7374251b9787 100644 --- a/include/net/inet_frag.h +++ b/include/net/inet_frag.h | |||
@@ -54,6 +54,7 @@ void inet_frags_init(struct inet_frags *); | |||
54 | void inet_frags_fini(struct inet_frags *); | 54 | void inet_frags_fini(struct inet_frags *); |
55 | 55 | ||
56 | void inet_frags_init_net(struct netns_frags *nf); | 56 | void inet_frags_init_net(struct netns_frags *nf); |
57 | void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f); | ||
57 | 58 | ||
58 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); | 59 | void inet_frag_kill(struct inet_frag_queue *q, struct inet_frags *f); |
59 | void inet_frag_destroy(struct inet_frag_queue *q, | 60 | void inet_frag_destroy(struct inet_frag_queue *q, |
diff --git a/net/ipv4/inet_fragment.c b/net/ipv4/inet_fragment.c index f1b95e128772..724d69aed031 100644 --- a/net/ipv4/inet_fragment.c +++ b/net/ipv4/inet_fragment.c | |||
@@ -83,6 +83,13 @@ void inet_frags_fini(struct inet_frags *f) | |||
83 | } | 83 | } |
84 | EXPORT_SYMBOL(inet_frags_fini); | 84 | EXPORT_SYMBOL(inet_frags_fini); |
85 | 85 | ||
86 | void inet_frags_exit_net(struct netns_frags *nf, struct inet_frags *f) | ||
87 | { | ||
88 | nf->low_thresh = 0; | ||
89 | inet_frag_evictor(nf, f); | ||
90 | } | ||
91 | EXPORT_SYMBOL(inet_frags_exit_net); | ||
92 | |||
86 | static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f) | 93 | static inline void fq_unlink(struct inet_frag_queue *fq, struct inet_frags *f) |
87 | { | 94 | { |
88 | write_lock(&f->lock); | 95 | write_lock(&f->lock); |
diff --git a/net/ipv4/ip_fragment.c b/net/ipv4/ip_fragment.c index 29b4b0972e44..a2e92f9709db 100644 --- a/net/ipv4/ip_fragment.c +++ b/net/ipv4/ip_fragment.c | |||
@@ -713,9 +713,20 @@ static int ipv4_frags_init_net(struct net *net) | |||
713 | return ip4_frags_ctl_register(net); | 713 | return ip4_frags_ctl_register(net); |
714 | } | 714 | } |
715 | 715 | ||
716 | static void ipv4_frags_exit_net(struct net *net) | ||
717 | { | ||
718 | ip4_frags_ctl_unregister(net); | ||
719 | inet_frags_exit_net(&net->ipv4.frags, &ip4_frags); | ||
720 | } | ||
721 | |||
722 | static struct pernet_operations ip4_frags_ops = { | ||
723 | .init = ipv4_frags_init_net, | ||
724 | .exit = ipv4_frags_exit_net, | ||
725 | }; | ||
726 | |||
716 | void __init ipfrag_init(void) | 727 | void __init ipfrag_init(void) |
717 | { | 728 | { |
718 | ipv4_frags_init_net(&init_net); | 729 | register_pernet_subsys(&ip4_frags_ops); |
719 | ip4_frags.hashfn = ip4_hashfn; | 730 | ip4_frags.hashfn = ip4_hashfn; |
720 | ip4_frags.constructor = ip4_frag_init; | 731 | ip4_frags.constructor = ip4_frag_init; |
721 | ip4_frags.destructor = ip4_frag_free; | 732 | ip4_frags.destructor = ip4_frag_free; |
diff --git a/net/ipv6/reassembly.c b/net/ipv6/reassembly.c index 0c4bc46dee0c..f936d045a39d 100644 --- a/net/ipv6/reassembly.c +++ b/net/ipv6/reassembly.c | |||
@@ -728,6 +728,17 @@ static int ipv6_frags_init_net(struct net *net) | |||
728 | return ip6_frags_sysctl_register(net); | 728 | return ip6_frags_sysctl_register(net); |
729 | } | 729 | } |
730 | 730 | ||
731 | static void ipv6_frags_exit_net(struct net *net) | ||
732 | { | ||
733 | ip6_frags_sysctl_unregister(net); | ||
734 | inet_frags_exit_net(&net->ipv6.frags, &ip6_frags); | ||
735 | } | ||
736 | |||
737 | static struct pernet_operations ip6_frags_ops = { | ||
738 | .init = ipv6_frags_init_net, | ||
739 | .exit = ipv6_frags_exit_net, | ||
740 | }; | ||
741 | |||
731 | int __init ipv6_frag_init(void) | 742 | int __init ipv6_frag_init(void) |
732 | { | 743 | { |
733 | int ret; | 744 | int ret; |
@@ -736,7 +747,7 @@ int __init ipv6_frag_init(void) | |||
736 | if (ret) | 747 | if (ret) |
737 | goto out; | 748 | goto out; |
738 | 749 | ||
739 | ipv6_frags_init_net(&init_net); | 750 | register_pernet_subsys(&ip6_frags_ops); |
740 | 751 | ||
741 | ip6_frags.hashfn = ip6_hashfn; | 752 | ip6_frags.hashfn = ip6_hashfn; |
742 | ip6_frags.constructor = ip6_frag_init; | 753 | ip6_frags.constructor = ip6_frag_init; |
@@ -754,5 +765,6 @@ out: | |||
754 | void ipv6_frag_exit(void) | 765 | void ipv6_frag_exit(void) |
755 | { | 766 | { |
756 | inet_frags_fini(&ip6_frags); | 767 | inet_frags_fini(&ip6_frags); |
768 | unregister_pernet_subsys(&ip6_frags_ops); | ||
757 | inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); | 769 | inet6_del_protocol(&frag_protocol, IPPROTO_FRAGMENT); |
758 | } | 770 | } |