diff options
author | Pablo Neira Ayuso <pablo@netfilter.org> | 2009-06-02 14:08:38 -0400 |
---|---|---|
committer | pablo <pablo@1984.(none)> | 2009-06-02 14:08:38 -0400 |
commit | 274d383b9c1906847a64bbb267b0183599ce86a0 (patch) | |
tree | c5a75eb38b79a05b11f25542ebad45c1c4c4410b | |
parent | 03b64f518a893512d32f07a10b053e558beafcaf (diff) |
netfilter: conntrack: don't report events on module removal
During the module removal there are no possible event listeners
since ctnetlink must be removed before to allow removing
nf_conntrack. This patch removes the event reporting for the
module removal case which is not of any use in the existing code.
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | include/net/netfilter/nf_conntrack.h | 2 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_core.c | 15 | ||||
-rw-r--r-- | net/netfilter/nf_conntrack_netlink.c | 6 |
3 files changed, 14 insertions, 9 deletions
diff --git a/include/net/netfilter/nf_conntrack.h b/include/net/netfilter/nf_conntrack.h index b909241b668e..2ba36dd33aeb 100644 --- a/include/net/netfilter/nf_conntrack.h +++ b/include/net/netfilter/nf_conntrack.h | |||
@@ -203,7 +203,7 @@ __nf_conntrack_find(struct net *net, const struct nf_conntrack_tuple *tuple); | |||
203 | 203 | ||
204 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); | 204 | extern void nf_conntrack_hash_insert(struct nf_conn *ct); |
205 | 205 | ||
206 | extern void nf_conntrack_flush(struct net *net, u32 pid, int report); | 206 | extern void nf_conntrack_flush_report(struct net *net, u32 pid, int report); |
207 | 207 | ||
208 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, | 208 | extern bool nf_ct_get_tuplepr(const struct sk_buff *skb, |
209 | unsigned int nhoff, u_int16_t l3num, | 209 | unsigned int nhoff, u_int16_t l3num, |
diff --git a/net/netfilter/nf_conntrack_core.c b/net/netfilter/nf_conntrack_core.c index 8020db6274b8..f59c4edf905a 100644 --- a/net/netfilter/nf_conntrack_core.c +++ b/net/netfilter/nf_conntrack_core.c | |||
@@ -1001,7 +1001,7 @@ struct __nf_ct_flush_report { | |||
1001 | int report; | 1001 | int report; |
1002 | }; | 1002 | }; |
1003 | 1003 | ||
1004 | static int kill_all(struct nf_conn *i, void *data) | 1004 | static int kill_report(struct nf_conn *i, void *data) |
1005 | { | 1005 | { |
1006 | struct __nf_ct_flush_report *fr = (struct __nf_ct_flush_report *)data; | 1006 | struct __nf_ct_flush_report *fr = (struct __nf_ct_flush_report *)data; |
1007 | 1007 | ||
@@ -1013,6 +1013,11 @@ static int kill_all(struct nf_conn *i, void *data) | |||
1013 | return 1; | 1013 | return 1; |
1014 | } | 1014 | } |
1015 | 1015 | ||
1016 | static int kill_all(struct nf_conn *i, void *data) | ||
1017 | { | ||
1018 | return 1; | ||
1019 | } | ||
1020 | |||
1016 | void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size) | 1021 | void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size) |
1017 | { | 1022 | { |
1018 | if (vmalloced) | 1023 | if (vmalloced) |
@@ -1023,15 +1028,15 @@ void nf_ct_free_hashtable(void *hash, int vmalloced, unsigned int size) | |||
1023 | } | 1028 | } |
1024 | EXPORT_SYMBOL_GPL(nf_ct_free_hashtable); | 1029 | EXPORT_SYMBOL_GPL(nf_ct_free_hashtable); |
1025 | 1030 | ||
1026 | void nf_conntrack_flush(struct net *net, u32 pid, int report) | 1031 | void nf_conntrack_flush_report(struct net *net, u32 pid, int report) |
1027 | { | 1032 | { |
1028 | struct __nf_ct_flush_report fr = { | 1033 | struct __nf_ct_flush_report fr = { |
1029 | .pid = pid, | 1034 | .pid = pid, |
1030 | .report = report, | 1035 | .report = report, |
1031 | }; | 1036 | }; |
1032 | nf_ct_iterate_cleanup(net, kill_all, &fr); | 1037 | nf_ct_iterate_cleanup(net, kill_report, &fr); |
1033 | } | 1038 | } |
1034 | EXPORT_SYMBOL_GPL(nf_conntrack_flush); | 1039 | EXPORT_SYMBOL_GPL(nf_conntrack_flush_report); |
1035 | 1040 | ||
1036 | static void nf_conntrack_cleanup_init_net(void) | 1041 | static void nf_conntrack_cleanup_init_net(void) |
1037 | { | 1042 | { |
@@ -1045,7 +1050,7 @@ static void nf_conntrack_cleanup_net(struct net *net) | |||
1045 | nf_ct_event_cache_flush(net); | 1050 | nf_ct_event_cache_flush(net); |
1046 | nf_conntrack_ecache_fini(net); | 1051 | nf_conntrack_ecache_fini(net); |
1047 | i_see_dead_people: | 1052 | i_see_dead_people: |
1048 | nf_conntrack_flush(net, 0, 0); | 1053 | nf_ct_iterate_cleanup(net, kill_all, NULL); |
1049 | if (atomic_read(&net->ct.count) != 0) { | 1054 | if (atomic_read(&net->ct.count) != 0) { |
1050 | schedule(); | 1055 | schedule(); |
1051 | goto i_see_dead_people; | 1056 | goto i_see_dead_people; |
diff --git a/net/netfilter/nf_conntrack_netlink.c b/net/netfilter/nf_conntrack_netlink.c index 58fde0e47b05..3a20de1be63c 100644 --- a/net/netfilter/nf_conntrack_netlink.c +++ b/net/netfilter/nf_conntrack_netlink.c | |||
@@ -777,9 +777,9 @@ ctnetlink_del_conntrack(struct sock *ctnl, struct sk_buff *skb, | |||
777 | err = ctnetlink_parse_tuple(cda, &tuple, CTA_TUPLE_REPLY, u3); | 777 | err = ctnetlink_parse_tuple(cda, &tuple, CTA_TUPLE_REPLY, u3); |
778 | else { | 778 | else { |
779 | /* Flush the whole table */ | 779 | /* Flush the whole table */ |
780 | nf_conntrack_flush(&init_net, | 780 | nf_conntrack_flush_report(&init_net, |
781 | NETLINK_CB(skb).pid, | 781 | NETLINK_CB(skb).pid, |
782 | nlmsg_report(nlh)); | 782 | nlmsg_report(nlh)); |
783 | return 0; | 783 | return 0; |
784 | } | 784 | } |
785 | 785 | ||