Skip to content

Write the saved capture from the handle it was captured on - #37

Merged
git-hulk merged 1 commit into
masterfrom
design-single-pcap-handle
Sep 2, 2026
Merged

Write the saved capture from the handle it was captured on#37
git-hulk merged 1 commit into
masterfrom
design-single-pcap-handle

Conversation

@git-hulk

@git-hulk git-hulk commented Sep 2, 2026

Copy link
Copy Markdown
Owner

dumper_create opened a second live capture on the same interface,
compiled the filter onto it again and ran its own pcap_loop in its own
thread. So -w doubled the kernel capture cost and, because the two
handles are independent, saved a different set of packets from the ones
being analysed. It was also skipped entirely when reading a file, so
-r in.pcap -w out.pcap silently wrote nothing.

The sniffer now owns the dump file and writes each frame from its own
handler, before anything is parsed, so the saved capture is exactly what
libpcap delivered. That drops the second handle, the dumper thread and
its loop, and makes -w work with -r.

🤖 Generated with Claude Code

@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 060ee91 to 4395653 Compare September 2, 2026 11:45
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 4395653 to 6682099 Compare September 2, 2026 11:46
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 6682099 to 0f230db Compare September 2, 2026 11:47
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 0f230db to 3f08850 Compare September 2, 2026 11:58
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 3f08850 to 32e3312 Compare September 2, 2026 12:15
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 32e3312 to 6aa59a2 Compare September 2, 2026 12:24
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 6aa59a2 to 46b92a5 Compare September 2, 2026 12:26
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 46b92a5 to 71b9cef Compare September 2, 2026 12:27
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from 71b9cef to e97f1ea Compare September 2, 2026 12:28
Base automatically changed from design-request-eviction to master September 2, 2026 12:31
dumper_create opened a *second* live capture on the same interface,
compiled the filter onto it again and ran its own pcap_loop in its own
thread. So `-w` doubled the kernel capture cost and, because the two
handles are independent, saved a different set of packets from the ones
being analysed. It was also skipped entirely when reading a file, so
`-r in.pcap -w out.pcap` silently wrote nothing.

The sniffer now owns the dump file and writes each frame from its own
handler, before anything is parsed, so the saved capture is exactly what
libpcap delivered. That drops the second handle, the dumper thread and
its loop, and makes -w work with -r.

Assistant By Opus 5

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@git-hulk
git-hulk force-pushed the design-single-pcap-handle branch from e97f1ea to d2a9484 Compare September 2, 2026 12:31
@git-hulk
git-hulk merged commit 7c633ab into master Sep 2, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant