Document the NfQeueue verdict landmine to prevent regression #73
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!73
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "issue33_document_nfqueue_verdict_landmine"
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 #33
Background
Found while investigating #4. The vendored
github.com/florianl/go-nfqueue@v1.3.2'sSetVerdicthard-codes the verdict word's upper 3 bytes to zero, with no way to encode a target queue number into anNF_QUEUE-type verdict - everynfqueue.NfQeueueverdict this codebase issued actually asked the kernel to requeue to queue 0, which nothing here is ever bound to, so the packet was silently dropped rather than redelivered. This is exactly what bitgetNfCallbackbefore issue #4's fix replaced its twoNfQeueueverdicts withNfAccept.Finding
A full
grep -rn NfQeueue internal/across the codebase turned up zero remaining call sites - #4's fix already removed every use of it. There's no live bug left to fix here.Change
Purely preventative: added a doc comment on
setVerdict(the one function every verdict flows through) spelling out the defect, so a future contributor can't reintroduce a call toNfQeueuewithout realizing it's silently broken.Testing
Documentation-only change -
make lint/make testboth clean, no behavior change.Related
Last of the four tickets split out from the #4 investigation (#4 v1.1.1 -> #32 v1.1.2 -> #31 v1.1.3 -> this one). After this, next up is #30 ("Possible edit race condition?", the web UI config-edit feature).
mentioned in issue #33
assigned to @danny
assigned to @claude and unassigned @danny
requested review from @danny
Considering the typo flagged in issue #41 and the fact that same typo is included in this ticket, please recheck the codebase with both the correct (NfQueue) and incorrect (NfQeueue) spellings.
requested changes
Rechecked with both spellings - this isn't actually a typo of mine.
NfQeueueis the real, exported verdict constant name in the third-partygithub.com/florianl/go-nfqueue@v1.3.2library itself - a typo in that library, not something I introduced. Evidence, straight from the vendored module source on disk (~/go/pkg/mod/github.com/florianl/go-nfqueue@v1.3.2/types.go:158-165):There is no
NfQueueverdict constant exported by this library at all - code that tried to callnfqueue.NfQueueas a verdict simply wouldn't compile. Confirmed no newer version fixes this either:go list -m -versions github.com/florianl/go-nfqueueshows v1.3.2 (our pinned version) is the latest available.What does exist, spelled correctly, is a completely different identifier in the same package:
nfqueue.Config.NfQueue(auint16struct field - "which queue number to bind this listener to", used once ininitNfqueue:NfQueue: uint16(conn.QueueNumber)). The two look almost identical at a glance (NfQueuethe correctly-spelled config field for a queue number, vsNfQeueuethe genuinely-misspelled-upstream verdict constant) - exactly why this is easy to mistake for a Claude-introduced error.I grepped every
.goand.mdfile in the repo for both spellings to be sure:NfQeueueoccurrence (innfq_forwarder.gocode/comments andCLAUDE.md) correctly refers to the verdict constant, matching the library's real (if misspelled) exported name.NfQueueoccurrence (nfq_forwarder.go:632) correctly refers to the unrelatedConfig.NfQueuefield.No inconsistency or genuine typo found either direction. I don't think there's a code or doc change needed here - happy to add an explicit comment calling out the "these look alike but are different identifiers" trap if that would help future readers, but wanted to confirm this finding with you first, given #41's premise turned out to be a very understandable but mistaken reading.
Ok, looks good.
approved this merge request
mentioned in commit
acda1b5b7bmentioned in merge request !74