Always verdict before returning from getNfCallback - don't kill the queue's read loop #71
No reviewers
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
keyop-go/nfq_forwarder!71
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue32_dont_kill_queue_on_bad_packet"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Closes #32
Background
Found while investigating #4.
getNfCallback'sgetPacketInfoerror path (a malformed/unparseable packet) returned1from the callback with no verdict ever set on that packet.go-nfqueue's read loop treats any non-zero callback return as fatal and never restarts that queue's read loop for the rest of the process's life -runConnectionhas no logic to detect or recover from this either.This meant a single malformed/truncated packet didn't just fail to get a verdict - it silently ended all packet processing for every destination on that connection, for the rest of the process's uptime, with nothing surfacing the failure short of noticing traffic had stopped. Much larger blast radius than a single dropped packet.
Fix
getPacketInfofailure now issues an explicitnfqueue.NfDropverdict (the packet can't be safely forwarded since it couldn't even be parsed) and returns0, keeping the read loop alive for every other destination on the connection.Testing
TestGetNfCallbackBadPacketDropsWithoutKillingTheQueue(renamed from...ReturnsOneWithoutVerdict) asserts the callback now returns0with anNfDropverdict set, rather than1with none - a direct regression test against reintroducing the read-loop-killing bug.make lint/make testboth clean.Docs
Added a
CLAUDE.mdDesign notes bullet explaining thego-nfqueuecontract (any non-zero callback return is fatal to that queue) and why every path throughgetNfCallbackmust verdict-then-return-0.Related
Part of the same investigation as #4 (merged, v1.1.1). Next in the agreed order: #31 (unconditional drop + a 5s blanket cooldown affecting unrelated destinations), then #33.
mentioned in issue #32
assigned to @danny
requested review from @danny
All seems fine - approved and will set to auto-merge. Please release as a patch version bump.
approved this merge request
mentioned in commit
a1cae03277