netfilter: Refactor nf_conncount
authorYi-Hung Wei <yihung.wei@gmail.com>
Sun, 4 Mar 2018 23:29:51 +0000 (15:29 -0800)
committerPablo Neira Ayuso <pablo@netfilter.org>
Tue, 20 Mar 2018 12:27:17 +0000 (13:27 +0100)
Remove parameter 'family' in nf_conncount_count() and count_tree().
It is because the parameter is not useful after commit 625c556118f3
("netfilter: connlimit: split xt_connlimit into front and backend").

Signed-off-by: Yi-Hung Wei <yihung.wei@gmail.com>
Acked-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
include/net/netfilter/nf_conntrack_count.h
net/netfilter/nf_conncount.c
net/netfilter/xt_connlimit.c

index adf8db44cf860d61dd7e64074c93f865f511bf5c..e61184fbfb710c06632a91d6362401079fd98462 100644 (file)
@@ -11,7 +11,6 @@ void nf_conncount_destroy(struct net *net, unsigned int family,
 unsigned int nf_conncount_count(struct net *net,
                                struct nf_conncount_data *data,
                                const u32 *key,
-                               unsigned int family,
                                const struct nf_conntrack_tuple *tuple,
                                const struct nf_conntrack_zone *zone);
 #endif
index 6d65389e308f4ba10c5eac881758833fe22909d6..9305a08b442272b9f559926b7986fa6867becc0c 100644 (file)
@@ -158,7 +158,6 @@ static void tree_nodes_free(struct rb_root *root,
 static unsigned int
 count_tree(struct net *net, struct rb_root *root,
           const u32 *key, u8 keylen,
-          u8 family,
           const struct nf_conntrack_tuple *tuple,
           const struct nf_conntrack_zone *zone)
 {
@@ -246,7 +245,6 @@ count_tree(struct net *net, struct rb_root *root,
 unsigned int nf_conncount_count(struct net *net,
                                struct nf_conncount_data *data,
                                const u32 *key,
-                               unsigned int family,
                                const struct nf_conntrack_tuple *tuple,
                                const struct nf_conntrack_zone *zone)
 {
@@ -259,7 +257,7 @@ unsigned int nf_conncount_count(struct net *net,
 
        spin_lock_bh(&nf_conncount_locks[hash % CONNCOUNT_LOCK_SLOTS]);
 
-       count = count_tree(net, root, key, data->keylen, family, tuple, zone);
+       count = count_tree(net, root, key, data->keylen, tuple, zone);
 
        spin_unlock_bh(&nf_conncount_locks[hash % CONNCOUNT_LOCK_SLOTS]);
 
index b1b17b9353e1d10b111c19755aa4e6b7143bda90..6275106ccf508fd83d62e4b7b48d2f07587614fb 100644 (file)
@@ -67,8 +67,8 @@ connlimit_mt(const struct sk_buff *skb, struct xt_action_param *par)
                key[1] = zone->id;
        }
 
-       connections = nf_conncount_count(net, info->data, key,
-                                        xt_family(par), tuple_ptr, zone);
+       connections = nf_conncount_count(net, info->data, key, tuple_ptr,
+                                        zone);
        if (connections == 0)
                /* kmalloc failed, drop it entirely */
                goto hotdrop;