Skip to content

Commit 830af2e

Browse files
Florian Westphalummakynes
authored andcommitted
netfilter: conntrack: don't increment invalid counter on NF_REPEAT
The packet isn't invalid, REPEAT means we're trying again after cleaning out a stale connection, e.g. via tcp tracker. This caused increases of invalid stat counter in a test case involving frequent connection reuse, even though no packet is actually invalid. Fixes: 56a62e2 ("netfilter: conntrack: fix NF_REPEAT handling") Signed-off-by: Florian Westphal <fw@strlen.de> Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>
1 parent 7d70984 commit 830af2e

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

net/netfilter/nf_conntrack_core.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1924,15 +1924,17 @@ nf_conntrack_in(struct sk_buff *skb, const struct nf_hook_state *state)
19241924
pr_debug("nf_conntrack_in: Can't track with proto module\n");
19251925
nf_ct_put(ct);
19261926
skb->_nfct = 0;
1927-
NF_CT_STAT_INC_ATOMIC(state->net, invalid);
1928-
if (ret == -NF_DROP)
1929-
NF_CT_STAT_INC_ATOMIC(state->net, drop);
19301927
/* Special case: TCP tracker reports an attempt to reopen a
19311928
* closed/aborted connection. We have to go back and create a
19321929
* fresh conntrack.
19331930
*/
19341931
if (ret == -NF_REPEAT)
19351932
goto repeat;
1933+
1934+
NF_CT_STAT_INC_ATOMIC(state->net, invalid);
1935+
if (ret == -NF_DROP)
1936+
NF_CT_STAT_INC_ATOMIC(state->net, drop);
1937+
19361938
ret = -ret;
19371939
goto out;
19381940
}

0 commit comments

Comments
 (0)