summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorFlorian Westphal <fw@strlen.de>2021-09-08 14:02:24 +0200
committerFlorian Westphal <fw@strlen.de>2021-09-08 14:02:24 +0200
commit420470004059c81f7ba83d655e6d27c921c652d2 (patch)
tree2184e78216f9713e62b75d99771a1524d5418877 /src
parentda096d06a4b5c81a0476d7d4871f5f3d06566a30 (diff)
conntrack: add support for chaintoolong stat counter
While at it, also fix up commit 5ec55c2a0a264 ("conntrack: add support for CLASH_RESOLVED counter"). The intention was to also print unknown statistic counters provided the attributes are of type u32, but mnl_attr_type_valid() needs the correct max-attr number for this to work. With this fix in place, conntrack -S shows: cpu=3 found=0 inv[..] clash_resolve=0 unknown1=8200 on a modified kernel. Signed-off-by: Florian Westphal <fw@strlen.de>
Diffstat (limited to 'src')
-rw-r--r--src/conntrack.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/conntrack.c b/src/conntrack.c
index ef7f604..9e2fa25 100644
--- a/src/conntrack.c
+++ b/src/conntrack.c
@@ -2486,12 +2486,14 @@ nfct_mnl_get(uint16_t subsys, uint16_t type, mnl_cb_t cb, uint8_t family)
return mnl_cb_run(buf, res, nlh->nlmsg_seq, sock.portid, cb, NULL);
}
+#define UNKNOWN_STATS_NUM 4
+
static int nfct_stats_attr_cb(const struct nlattr *attr, void *data)
{
const struct nlattr **tb = data;
int type = mnl_attr_get_type(attr);
- if (mnl_attr_type_valid(attr, CTA_STATS_MAX) < 0)
+ if (mnl_attr_type_valid(attr, CTA_STATS_MAX + UNKNOWN_STATS_NUM) < 0)
return MNL_CB_OK;
if (mnl_attr_validate(attr, MNL_TYPE_U32) < 0) {
@@ -2503,8 +2505,6 @@ static int nfct_stats_attr_cb(const struct nlattr *attr, void *data)
return MNL_CB_OK;
}
-#define UNKNOWN_STATS_NUM 4
-
static int nfct_stats_cb(const struct nlmsghdr *nlh, void *data)
{
struct nlattr *tb[CTA_STATS_MAX + UNKNOWN_STATS_NUM + 1] = {};
@@ -2524,6 +2524,7 @@ static int nfct_stats_cb(const struct nlmsghdr *nlh, void *data)
[CTA_STATS_ERROR] = "error",
[CTA_STATS_SEARCH_RESTART] = "search_restart",
[CTA_STATS_CLASH_RESOLVE] = "clash_resolve",
+ [CTA_STATS_CHAIN_TOOLONG] = "chaintoolong",
/* leave at end. Allows to show counters supported
* by newer kernel with older conntrack-tools release.