Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

netfilter: conntrack: remove ignore stats

This counter increments when nf_conntrack_in sees a packet that already
has a conntrack attached or when the packet is marked as UNTRACKED.
Neither is an error.

The former is normal for loopback traffic. The second happens for
certain ICMPv6 packets or when nftables/ip(6)tables rules are in place.

In case someone needs to count UNTRACKED packets, or packets
that are marked as untracked before conntrack_in this can be done with
both nftables and ip(6)tables rules.

Signed-off-by: Florian Westphal <fw@strlen.de>
Signed-off-by: Pablo Neira Ayuso <pablo@netfilter.org>

authored by

Florian Westphal and committed by
Pablo Neira Ayuso
4afc41df b1328e54

+3 -7
-1
include/linux/netfilter/nf_conntrack_common.h
··· 8 8 struct ip_conntrack_stat { 9 9 unsigned int found; 10 10 unsigned int invalid; 11 - unsigned int ignore; 12 11 unsigned int insert; 13 12 unsigned int insert_failed; 14 13 unsigned int drop;
+1 -3
net/netfilter/nf_conntrack_core.c
··· 1800 1800 if (tmpl || ctinfo == IP_CT_UNTRACKED) { 1801 1801 /* Previously seen (loopback or untracked)? Ignore. */ 1802 1802 if ((tmpl && !nf_ct_is_template(tmpl)) || 1803 - ctinfo == IP_CT_UNTRACKED) { 1804 - NF_CT_STAT_INC_ATOMIC(state->net, ignore); 1803 + ctinfo == IP_CT_UNTRACKED) 1805 1804 return NF_ACCEPT; 1806 - } 1807 1805 skb->_nfct = 0; 1808 1806 } 1809 1807
-1
net/netfilter/nf_conntrack_netlink.c
··· 2509 2509 2510 2510 if (nla_put_be32(skb, CTA_STATS_FOUND, htonl(st->found)) || 2511 2511 nla_put_be32(skb, CTA_STATS_INVALID, htonl(st->invalid)) || 2512 - nla_put_be32(skb, CTA_STATS_IGNORE, htonl(st->ignore)) || 2513 2512 nla_put_be32(skb, CTA_STATS_INSERT, htonl(st->insert)) || 2514 2513 nla_put_be32(skb, CTA_STATS_INSERT_FAILED, 2515 2514 htonl(st->insert_failed)) ||
+1 -1
net/netfilter/nf_conntrack_standalone.c
··· 439 439 st->found, 440 440 0, 441 441 st->invalid, 442 - st->ignore, 442 + 0, 443 443 0, 444 444 0, 445 445 st->insert,