NfQeueue verdicts always requeue to queue 0 instead of the actual configured queue #33
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#33
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.
The vendored
github.com/florianl/go-nfqueue@v1.3.2'sSetVerdict(nfqueue.go~lines 330-372) hard-codes the verdict word's upper 3 bytes to zero (verdictData := append([]byte{0x0, 0x0, 0x0, byte(verdict)}, buf...), ~line 344) and its guard clause (~line 338) only accepts the raw verdict constants (NfDrop/NfAccept/NfStolen/NfQeueue/NfRepeat) - there is no way through this API to encode a target queue number into anNF_QUEUE-type verdict.That means every
nfqueue.NfQeueueverdict issued by this codebase (internal/nfq_forwarder/nfq_forwarder.go, e.g. theErrPortTunnelAlreadyOpenbranch and the success path ingetNfCallback) actually asks the kernel to requeue the packet to queue 0 - not the connection's actualqueue_number(always ≥ 1, enforced ininternal/config/load.go). Since queue 0 is never bound by any configured connection, the kernel'snf_queue()lookup fails and the packet is dropped rather than redelivered.Impact: any code path in this project relying on
NfQeueuefor redelivery/re-verdicting doesn't do what it looks like it does - it silently drops the packet instead. Directly relevant to #4's root cause, but is a distinct, independently-provable defect (in verdict encoding) from the hook-ordering issue tracked there - worth fixing/removing regardless of how #4 itself is resolved, since a future use ofNfQeueueelsewhere in this codebase would hit the same silent failure.See also #4 for the related architectural fix, which may make this moot for the primary packet path (if the fix replaces
NfQeueuereliance withNfAcceptafter DNAT insertion) - but any otherNfQeueuecall sites (e.g. an already-open tunnel) still need auditing against this.mentioned in issue #4
mentioned in merge request !70
mentioned in merge request !71
mentioned in merge request !72
mentioned in commit
42cd04857bmentioned in merge request !73
Implementation is up for review: !73 (branch
issue33_document_nfqueue_verdict_landmine). Audited the codebase for remainingNfQeueueusage - found none, since #4's fix already removed every call site. Purely a preventative doc comment onsetVerdictexplaining the defect. Waiting on review before merging.mentioned in commit
acda1b5b7bmentioned in merge request !74
Merged via !73 (merge commit
acda1b5) and released as v1.1.4 (patch bump).