23 return "search_complete";
37 , current_mtu_(config_.min_mtu)
38 , search_low_(config_.min_mtu)
39 , search_high_(config_.max_probe_mtu)
79 std::chrono::steady_clock::time_point now)
const noexcept ->
bool
96 auto elapsed = now - last_probe_time_;
97 return elapsed >= config_.probe_interval;
103 auto elapsed = now - search_complete_time_;
104 return elapsed >= config_.confirmation_interval;
110 auto elapsed = now - last_probe_time_;
111 return elapsed >= config_.probe_timeout;
139 size_t size, std::chrono::steady_clock::time_point sent_time)
257 -> std::optional<std::chrono::steady_clock::time_point>
Path MTU Discovery controller for QUIC (RFC 8899 DPLPMTUD)
void complete_search()
Transition to search_complete state.
std::chrono::steady_clock::time_point last_probe_time_
Time of last probe sent.
void on_packet_too_big(size_t reported_mtu)
Handle ICMP Packet Too Big message.
pmtud_controller()
Default constructor with default configuration.
pmtud_state state_
Current state.
size_t search_high_
Upper bound for binary search (target MTU)
void on_probe_sent(size_t size, std::chrono::steady_clock::time_point sent_time)
Record that a probe was sent.
void enable()
Enable PMTUD and start probing.
size_t search_low_
Lower bound for binary search (known good MTU)
size_t probe_count_
Number of probes sent at current size.
static constexpr size_t kBlackHoleThreshold
Threshold for black hole detection.
auto next_timeout() const noexcept -> std::optional< std::chrono::steady_clock::time_point >
Get next timeout deadline for PMTUD.
bool probe_in_flight_
Whether a probe is currently in flight.
void on_probe_acked(size_t size)
Handle probe acknowledgment.
void on_probe_lost(size_t size)
Handle probe loss.
void start_search()
Start probing from base MTU.
void reset()
Reset to initial state.
size_t current_mtu_
Current validated MTU.
size_t consecutive_failures_
Number of consecutive probe failures (for black hole detection)
pmtud_config config_
Configuration.
std::chrono::steady_clock::time_point search_complete_time_
Time when search was completed (for re-validation)
auto should_probe(std::chrono::steady_clock::time_point now) const noexcept -> bool
Check if a probe should be sent.
size_t probing_mtu_
Current probe size being tested.
void disable()
Disable PMTUD.
auto calculate_next_probe_size() const noexcept -> size_t
Calculate next probe size using binary search.
auto probe_size() const noexcept -> std::optional< size_t >
Get the size for next probe packet.
void on_timeout(std::chrono::steady_clock::time_point now)
Handle timeout event.
void handle_black_hole()
Handle black hole detection.
pmtud_state
States for DPLPMTUD state machine (RFC 8899 Section 5.2)
@ disabled
PMTUD is disabled.
@ search_complete
Maximum MTU found and validated.
@ base
Using BASE_PLPMTU (minimum MTU)
@ searching
Binary search for larger MTU.
@ error
Black hole detected, reset to base.
auto pmtud_state_to_string(pmtud_state state) noexcept -> const char *
Convert PMTUD state to string.
Configuration for PMTUD controller.
std::chrono::seconds probe_timeout
Timeout for probe packets before considering them lost.
std::chrono::milliseconds probe_interval
Interval between probe attempts during search.
size_t max_probes
Maximum number of probes before giving up at current size.
size_t probe_step
Step size for probing (binary search uses mid-point)
size_t max_probe_mtu
Maximum MTU to probe (typical Ethernet is 1500)
std::chrono::seconds confirmation_interval
Interval for re-validation after search is complete.
size_t min_mtu
Minimum MTU (RFC 9000 requires 1200 bytes for QUIC)