lib: log: support packet 5-tuple logging #578
All Vouch review confidence checks passed
Residual risk 0.20 = Change Risk (0.50) × (1 − Review Confidence (0.60)).
Review depth and reviewer attention state are adequate.
Model 1 · Change Risk (XGBoost)
Score: 0.50 · 589 lines diff across 7 files
Model 2 · Review Depth (DistilBERT)
Depth Score: 0.17 · 1 substantive comment(s)
Model 3 · Review Timing & Attention
Session adequacy: 100% · Reviewer familiarity: 35%
Bedrock Claude 3 · Risk Narration
(disconnected)
Groq Risk Narration
AWS Bedrock is currently disconnected. Generate high-confidence PR triage narration on-demand using Groq.
Model 1 · Change Risk Attribution
SHAP Weights
Diff Size
diff_size
0.382
Shallow Review Depth
shallow_review_depth
0.289
Real PR Conversation Timeline
1 comments
"Review active on #578"
general
weight: 0.35
blackdragoon26
<!--
Thanks for contributing to bpfilter.
Before opening this PR: you should understand and stand behind every line in it,
and you should have built and tested it with the real workflow, not a one-off
compile. If you used AI for any of it, that's fine, just say so below. See
https://bpfilter.io/developers/contributing.html for the details.
Fill in the sections below and remove the irrelevant ones.
-->
Summary
Add
log 5-tupleas an exclusive packet logging mode.The implementation introduces a dedicated ELF stub that emits compact records
containing source and destination addresses, source and destination ports, and
the transport protocol. It supports complete IPv4/IPv6 TCP/UDP tuples while
preserving the existing fixed-size
struct bf_logreservation and ring-buffercapacity.
Unsupported packets do not emit a tuple record or fall back to raw-header
logging. Their counters, marks, verdicts, and normal rule execution remain
unchanged.
<!-- What does this change do, and why? Keep it to the point. -->
Related issue
<!-- e.g. "Fixes #123". If there is no issue, explain why the change is needed. -->
Fixes #568
Testing
Added coverage for:
log 5-tuplesyntax, with and withouteverycgroup_sock_addrDebug build with sanitizers and coverage enabled:
Release build:
Additional
passedverification:make -C build-issue568fixstylemake -C build-issue568 test_bintestmake -C build-issue568 doc<!--
How did you verify this? Describe the build and tests you actually ran, not what
you expect CI to do. Configure and build with CMake as the developer docs
describe, run
make -C $BUILD test_bin test, andmake -C $BUILD docif youchanged the documentation.
If this is one of your first PRs here, paste the relevant test output below. The
summary line and pass counts are enough.
-->
Notes for the reviewer
5-tupleis mutually exclusive withlink,internet, andtransport.Tuple records are emitted only for IPv4/IPv6 packets using TCP or UDP, following
the eligibility behaviour discussed in #568. The eligibility check happens
before rate-limit bookkeeping, so an unsupported packet does not consume the
rule's
everyinterval.cgroup_sock_addris intentionally unsupported for this mode. Existing rawpacket logging and socket-address logging remain unchanged.
The new log type and ELF-stub identifiers are appended so existing identifier
values remain stable.
<!--
Optional. Anything I should know: open questions, deliberate scope limits,
tradeoffs you made, or areas you want feedback on. Flagging these here saves a
round trip.
-->
AI disclosure
I used AI for codebase exploration, understanding the existing logging and BPF
code-generation paths, design iteration, parts of the implementation and tests,
verification, review, and wording of this PR.
I reviewed the resulting design and test evidence and remain responsible for
the submitted changes.
<!--
First, read https://bpfilter.io/developers/contributing.html.
Did you use AI for any part of this (code, tests, this description)? Say so and
roughly for what. "None" is a fine answer. Undisclosed AI is grounds for closing
the PR.
-->
Checklist
make -C $BUILD test_bin testpasses and the code follows the style guidecomponent: subcomponent: short description