Skip to content

xfrm: parse state direction and IP-TFS counters from xfrm_stat - #906

Open
isleofgeorge wants to merge 1 commit into
prometheus:masterfrom
isleofgeorge:xfrm-stat-new-reasons
Open

isleofgeorge wants to merge 1 commit into
prometheus:masterfrom
isleofgeorge:xfrm-stat-new-reasons

Conversation

@isleofgeorge

Copy link
Copy Markdown

What

Add the four /proc/net/xfrm_stat counters that XfrmStat does not model yet:

Counter Added in Meaning
XfrmInStateDirError Linux 6.10 (torvalds/linux@304b44f0d5a4) input lookup found an output-direction state
XfrmOutStateDirError Linux 6.10 (torvalds/linux@601a0867f86c) output lookup found an input-direction state
XfrmInIptfsError Linux 6.14 (torvalds/linux@d1716d5a44c3) IP-TFS (RFC 9347) inbound packet processing error
XfrmOutNoQueueSpace Linux 6.14 (torvalds/linux@4b3faf610cc6) IP-TFS outbound queue full, packet dropped

With these, XfrmStat covers all 32 entries of xfrm_mib_list in mainline net/xfrm/xfrm_proc.c.

Why

NewXfrmStat ignores names it does not know, so on 6.10+ kernels these drops are read and thrown away. We hit this exporting per-reason xfrm drops from IPsec gateways on a 6.18 kernel: 32 counters in the file, 28 in the struct.

Behavior

Purely additive. The new fields are int like the existing ones and stay 0 on kernels that do not print them, which is how every other field in the struct already behaves.

Tests

Extended the net/xfrm_stat fixture with the four lines and asserted them in TestXfrmStats. make fixtures, make update_fixtures (no diff), make test, make style, make check_license and make lint all pass.


Disclosure: AI-assisted. I prepared this with an AI assistant and checked the kernel sources and test runs myself.

🤖 Generated with Claude Code

Linux 6.10 added XfrmInStateDirError and XfrmOutStateDirError, and
Linux 6.14 added XfrmInIptfsError and XfrmOutNoQueueSpace to
/proc/net/xfrm_stat. NewXfrmStat silently dropped them. Add them so
XfrmStat covers every counter in the kernel's xfrm_mib_list.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: George Rubin <george.rubin@island.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant