Repository navigation
Add --pcap packet capture export - #181
Merged
Merged
Conversation
A raw ICMPv6 receive socket on Linux reads Echo Replies too, so the send-socket poll wrote every reply a second time, up to a round late. The poll now records only on an unprivileged datagram socket, where the receive socket never sees them.
# Conflicts: # CHANGELOG.md
lance0
marked this pull request as ready for review
November 14, 2026 20:56
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
--pcap <FILE>: during a live trace (TUI, batch or streaming), every probe ttl sends and every ICMP packet the receiver reads go into a classic pcap file you can open in Wireshark or read withtcpdump -r. This is the "PCAP export" item from the ROADMAP Medium Effort list.Design
send_raw_ipv4,send_icmp,send_udp_probeandsend_tcp_probe. None of the engine send paths changed. The receive side gets one line in the receiver loop.engine.rsalso records in the Linux IPv6 Echo Reply poll, but only on an unprivileged datagram socket: a raw ICMPv6 receive socket reads Echo Replies too, so recording them in the poll as well would write each one twice.sync_channelwith room for 4096 packets, usingtry_send, and a writer thread writes them out. Probing never blocks. If the queue is full the packet is dropped and counted, and the count is printed to stderr at exit.O_NOFOLLOW.--pcapis rejected with--replayand--diffthrough the existing list of flags that are ignored in those modes.Tests
--pcapis rejected with replay and diff, and accepted in the live modesGates:
cargo fmt --check,cargo clippy --all-targets -- -D warnings,cargo clippy --all-targets --no-default-features -- -D warningsandcargo testall pass.Docs
docs/FEATURES.md gets a Packet Capture section and a CLI reference line, and the ROADMAP item is ticked.
Live check (docker, NET_RAW)
ttl -c 3 --no-tui -p {icmp,udp,tcp} --pcap /out/X.pcapagainst 1.1.1.1 and 2606:4700:4700::1111, then read back with tshark 4.2 andcapinfosin an ubuntu:24.04 container:::1, because a received IPv6 packet gets the local address as its destination.--resolve-allagainst one.one.one.one writes all four targets to one file. Pointing--pcapat a symlink fails and leaves the target file unchanged.IPv6 TCP sends fail with EINVAL on this host. master does the same (60 of 60 sends), so the failure is not caused by this change, and no IPv6 TCP capture was checked.
Not verified