Repository navigation
nmap C→Rust — M1: core::timing (RTT estimator + -T0..-T5 templates) - #5
Merged
Merged
Conversation
Rust port of timing.cc (adjust_timeouts2 / initialize_timeout_info) and the
timing-template table in nmap.cc / NmapOps.cc:
- TimeoutInfo: Jacobson/Karels RTT smoothing in fixed-point microseconds
(srtt/rttvar init to -1; first sample seeds; subsequent smooth via >>3/>>2;
bogus samples ignored; timeout clamped to the template's [min,max] RTT).
- TimingParams + TimingTemplate: Paranoid..Insane with nmap's exact
set{Initial,Max,Min}RttTimeout sibling-bound interactions; -T3 defaults from
MIN/MAX/INITIAL_RTT_TIMEOUT. Parallelism/scan-delay/retransmission knobs.
- box_clamp mirrors nmap's box() (no panic when min>max).
Pure #![forbid(unsafe_code)] math, no floats. Gates: fmt + clippy(-D) + 41 tests
+ unsafe-audit(0). progress: timing -> ported.
Co-Authored-By: Claude Fable 5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01JfEzHqD7a7TKDuUs5GwZ2w
kj299
marked this pull request as ready for review
July 9, 2026 18:46
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.
What this is
Milestone 1 module
core::timing— the Rust port of nmap'stiming.cc(adjust_timeouts2/initialize_timeout_info) and the timing-template table (nmap.cc/NmapOps.cc). Supplies the connect scan's per-probe timeout, parallelism, and scan-delay knobs.Changes
TimeoutInfo— the Jacobson/Karels RTT smoother in fixed-point microseconds (i64, no floats):srtt/rttvarseed on the first sample, then smooth via>>3/>>2; implausible samples (≥8 s, negative, or bogus deltas) are ignored exactly as the C does; the timeout is clamped to the template's[min, max]RTT window.TimingTemplate(Paranoid…Insane) +TimingParams— the-T0..-T5table with nmap's exactsetInitial/Max/MinRttTimeoutsibling-bound interactions (e.g.-T0raising max to 300 s,-T4= min 100 / max 1250 / initial 500 ms).-T3defaults fromMIN/MAX/INITIAL_RTT_TIMEOUT. Includes parallelism, scan-delay, and retransmission knobs.box_clampmirrors nmap'sbox()(returnsminwhenmin > max, no panic).Verified
-D warnings) + 41 unit tests + unsafe-audit (0 undocumented) — all green.>>3smoothing step, min-timeout clamp, bogus-sample rejection, the small-negative→10 ms rule, and the exact per-template RTT/parallelism/retransmission values for T0/T3/T4/T5.Pure
#[forbid(unsafe_code)]math — no I/O, nounsafe.🤖 Generated with Claude Code
Generated by Claude Code