An unparseable packet permanently kills its nfqueue read loop - silent total packet-processing failure for that connection #32
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#32
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
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?
Found while investigating #4.
In
getNfCallback(internal/nfq_forwarder/nfq_forwarder.go), thegetPacketInfoerror path (~lines 626-629, a malformed/unparseable packet) returns1from the callback without ever callingsetVerdicton that packet.go-nfqueue's read loop (socketCallback, vendoredgithub.com/florianl/go-nfqueue@v1.3.2/nfqueue.go~lines 419-421) treats any non-zero return from the callback as fatal:if ret := fn(m); ret != 0 { return }- this permanently stops that queue's entire read loop for the remaining life of the process.runConnection(nfq_forwarder.go~lines 735-787) has no logic to detect this or restart the queue.Impact: a single malformed or unparseable packet (e.g. a truncated/fragmented capture) doesn't just fail to get a verdict - it silently ends all packet processing for every destination on that connection for the rest of the process's uptime, with no error surfaced anywhere obvious and no automatic recovery short of a full process restart. This is a much larger blast radius than a single dropped packet.
Fix direction:
getPacketInfofailure should still issue a verdict (presumablyNfDrop, since the packet can't be safely forwarded) so the callback always returns 0, keeping the read loop alive.mentioned in issue #4
mentioned in merge request !70
mentioned in commit
ff463817f6mentioned in merge request !71
Implementation is up for review: !71 (branch
issue32_dont_kill_queue_on_bad_packet).getPacketInfofailure now sets an explicitNfDropverdict and returns 0, rather than returning 1 with no verdict at all (which permanently killed that queue's read loop per go-nfqueue's contract). Waiting on review before merging.mentioned in commit
a1cae03277Merged via !71 (merge commit
a1cae03) and released as v1.1.2 (patch bump).mentioned in merge request !72
mentioned in merge request !73