|
@@ -104,7 +104,7 @@ static unsigned int check_hlist(struct net *net,
|
|
struct nf_conn *found_ct;
|
|
struct nf_conn *found_ct;
|
|
unsigned int length = 0;
|
|
unsigned int length = 0;
|
|
|
|
|
|
- *addit = true;
|
|
|
|
|
|
+ *addit = tuple ? true : false;
|
|
|
|
|
|
/* check the saved connections */
|
|
/* check the saved connections */
|
|
hlist_for_each_entry_safe(conn, n, head, node) {
|
|
hlist_for_each_entry_safe(conn, n, head, node) {
|
|
@@ -117,7 +117,7 @@ static unsigned int check_hlist(struct net *net,
|
|
|
|
|
|
found_ct = nf_ct_tuplehash_to_ctrack(found);
|
|
found_ct = nf_ct_tuplehash_to_ctrack(found);
|
|
|
|
|
|
- if (nf_ct_tuple_equal(&conn->tuple, tuple)) {
|
|
|
|
|
|
+ if (tuple && nf_ct_tuple_equal(&conn->tuple, tuple)) {
|
|
/*
|
|
/*
|
|
* Just to be sure we have it only once in the list.
|
|
* Just to be sure we have it only once in the list.
|
|
* We should not see tuples twice unless someone hooks
|
|
* We should not see tuples twice unless someone hooks
|
|
@@ -220,6 +220,9 @@ count_tree(struct net *net, struct rb_root *root,
|
|
goto restart;
|
|
goto restart;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ if (!tuple)
|
|
|
|
+ return 0;
|
|
|
|
+
|
|
/* no match, need to insert new node */
|
|
/* no match, need to insert new node */
|
|
rbconn = kmem_cache_alloc(conncount_rb_cachep, GFP_ATOMIC);
|
|
rbconn = kmem_cache_alloc(conncount_rb_cachep, GFP_ATOMIC);
|
|
if (rbconn == NULL)
|
|
if (rbconn == NULL)
|
|
@@ -242,6 +245,9 @@ count_tree(struct net *net, struct rb_root *root,
|
|
return 1;
|
|
return 1;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+/* Count and return number of conntrack entries in 'net' with particular 'key'.
|
|
|
|
+ * If 'tuple' is not null, insert it into the accounting data structure.
|
|
|
|
+ */
|
|
unsigned int nf_conncount_count(struct net *net,
|
|
unsigned int nf_conncount_count(struct net *net,
|
|
struct nf_conncount_data *data,
|
|
struct nf_conncount_data *data,
|
|
const u32 *key,
|
|
const u32 *key,
|