diff options
author | Patrick McHardy <kaber@trash.net> | 2014-02-18 13:06:49 -0500 |
---|---|---|
committer | Pablo Neira Ayuso <pablo@netfilter.org> | 2014-02-25 05:29:23 -0500 |
commit | 67a8fc27cca06e185c1ab39baaccd2103f6f9f51 (patch) | |
tree | bc3cb68c22bd37a3b5285ca6b0819ea9c760cffb | |
parent | 0eb5db7ad302a24fe6f0eb4bfd235357047a28db (diff) |
netfilter: nf_tables: add nft_dereference() macro
Signed-off-by: Patrick McHardy <kaber@trash.net>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
-rw-r--r-- | include/net/netfilter/nf_tables.h | 4 | ||||
-rw-r--r-- | net/netfilter/nf_tables_api.c | 3 |
2 files changed, 5 insertions, 2 deletions
diff --git a/include/net/netfilter/nf_tables.h b/include/net/netfilter/nf_tables.h index e7e14ffe0f6a..81abd61500f4 100644 --- a/include/net/netfilter/nf_tables.h +++ b/include/net/netfilter/nf_tables.h | |||
@@ -3,6 +3,7 @@ | |||
3 | 3 | ||
4 | #include <linux/list.h> | 4 | #include <linux/list.h> |
5 | #include <linux/netfilter.h> | 5 | #include <linux/netfilter.h> |
6 | #include <linux/netfilter/nfnetlink.h> | ||
6 | #include <linux/netfilter/x_tables.h> | 7 | #include <linux/netfilter/x_tables.h> |
7 | #include <linux/netfilter/nf_tables.h> | 8 | #include <linux/netfilter/nf_tables.h> |
8 | #include <net/netlink.h> | 9 | #include <net/netlink.h> |
@@ -521,6 +522,9 @@ void nft_unregister_chain_type(const struct nf_chain_type *); | |||
521 | int nft_register_expr(struct nft_expr_type *); | 522 | int nft_register_expr(struct nft_expr_type *); |
522 | void nft_unregister_expr(struct nft_expr_type *); | 523 | void nft_unregister_expr(struct nft_expr_type *); |
523 | 524 | ||
525 | #define nft_dereference(p) \ | ||
526 | nfnl_dereference(p, NFNL_SUBSYS_NFTABLES) | ||
527 | |||
524 | #define MODULE_ALIAS_NFT_FAMILY(family) \ | 528 | #define MODULE_ALIAS_NFT_FAMILY(family) \ |
525 | MODULE_ALIAS("nft-afinfo-" __stringify(family)) | 529 | MODULE_ALIAS("nft-afinfo-" __stringify(family)) |
526 | 530 | ||
diff --git a/net/netfilter/nf_tables_api.c b/net/netfilter/nf_tables_api.c index adce01e8bb57..4b7e14ddd2b2 100644 --- a/net/netfilter/nf_tables_api.c +++ b/net/netfilter/nf_tables_api.c | |||
@@ -794,9 +794,8 @@ nf_tables_counters(struct nft_base_chain *chain, const struct nlattr *attr) | |||
794 | stats->pkts = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_PACKETS])); | 794 | stats->pkts = be64_to_cpu(nla_get_be64(tb[NFTA_COUNTER_PACKETS])); |
795 | 795 | ||
796 | if (chain->stats) { | 796 | if (chain->stats) { |
797 | /* nfnl_lock is held, add some nfnl function for this, later */ | ||
798 | struct nft_stats __percpu *oldstats = | 797 | struct nft_stats __percpu *oldstats = |
799 | rcu_dereference_protected(chain->stats, 1); | 798 | nft_dereference(chain->stats); |
800 | 799 | ||
801 | rcu_assign_pointer(chain->stats, newstats); | 800 | rcu_assign_pointer(chain->stats, newstats); |
802 | synchronize_rcu(); | 801 | synchronize_rcu(); |