Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions quiche/include/quiche.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,10 @@ void quiche_config_grease(quiche_config *config, bool v);
// Configures whether to do path MTU discovery.
void quiche_config_discover_pmtu(quiche_config *config, bool v);

// Configures the number of non-probe packets between PMTUD probes.
void quiche_config_set_pmtud_pkts_between_probes(quiche_config *config,
size_t pkts);

// Enables logging of secrets.
void quiche_config_log_keys(quiche_config *config);

Expand Down
7 changes: 7 additions & 0 deletions quiche/src/ffi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,13 @@ pub extern "C" fn quiche_config_set_pmtud_max_probes(
config.set_pmtud_max_probes(max_probes);
}

#[no_mangle]
pub extern "C" fn quiche_config_set_pmtud_pkts_between_probes(
config: &mut Config, pkts: usize,
) {
config.set_pmtud_pkts_between_probes(pkts);
}

#[no_mangle]
pub extern "C" fn quiche_config_log_keys(config: &mut Config) {
config.log_keys();
Expand Down
24 changes: 22 additions & 2 deletions quiche/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -582,6 +582,7 @@ pub struct Config {

pmtud: bool,
pmtud_max_probes: u8,
pmtud_pkts_between_probes: usize,

hystart: bool,

Expand Down Expand Up @@ -667,6 +668,7 @@ impl Config {
enable_send_streams_blocked: false,
pmtud: false,
pmtud_max_probes: pmtud::MAX_PROBES_DEFAULT,
pmtud_pkts_between_probes: pmtud::PKTS_BETWEEN_PROBES,
hystart: true,
pacing: true,
max_pacing_rate: None,
Expand Down Expand Up @@ -795,6 +797,14 @@ impl Config {
self.pmtud_max_probes = max_probes;
}

/// Configures the number of non-probe packets that must be sent between
/// PMTUD probes.
///
/// The default value is `0`.
pub fn set_pmtud_pkts_between_probes(&mut self, pkts: usize) {
self.pmtud_pkts_between_probes = pkts;
}

/// Configures whether to send GREASE values.
///
/// The default value is `true`.
Expand Down Expand Up @@ -2704,10 +2714,11 @@ impl<F: BufFactory> Connection<F> {
#[cfg_attr(docsrs, doc(cfg(feature = "boringssl-boring-crate")))]
pub fn set_discover_pmtu_in_handshake(
ssl: &mut boring::ssl::SslRef, discover: bool, max_probes: u8,
pkts_between_probes: usize,
) -> Result<()> {
let ex_data = tls::ExData::from_ssl_ref(ssl).ok_or(Error::TlsFail)?;

ex_data.pmtud = Some((discover, max_probes));
ex_data.pmtud = Some((discover, max_probes, pkts_between_probes));

Ok(())
}
Expand Down Expand Up @@ -5518,6 +5529,12 @@ impl<F: BufFactory> Connection<F> {
path.sent_count += 1;
path.sent_bytes += written as u64;

if !is_pmtud_probe {
if let Some(pmtud) = path.pmtud.as_mut() {
pmtud.on_non_probe_sent();
}
}

if self.dgram_send_queue.byte_size() > path.recovery.cwnd_available() {
path.recovery.update_app_limited(false);
}
Expand Down Expand Up @@ -8065,11 +8082,14 @@ impl<F: BufFactory> Connection<F> {
self.tx_cap_factor = ex_data.tx_cap_factor;
}

if let Some((discover, max_probes)) = ex_data.pmtud {
if let Some((discover, max_probes, pkts_between_probes)) =
ex_data.pmtud
{
self.paths.set_discover_pmtu_on_existing_paths(
discover,
self.recovery_config.max_send_udp_payload_size,
max_probes,
pkts_between_probes,
);
}

Expand Down
9 changes: 7 additions & 2 deletions quiche/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,11 @@ impl Path {
.unwrap_or(c.max_send_udp_payload_size),
c.max_send_udp_payload_size,
);
Some(pmtud::Pmtud::new(maximum_supported_mtu, c.pmtud_max_probes))
Some(pmtud::Pmtud::new(
maximum_supported_mtu,
c.pmtud_max_probes,
c.pmtud_pkts_between_probes,
))
} else {
None
}
Expand Down Expand Up @@ -908,13 +912,14 @@ impl PathMap {
/// Configures path MTU discovery on all existing paths.
pub fn set_discover_pmtu_on_existing_paths(
&mut self, discover: bool, max_send_udp_payload_size: usize,
pmtud_max_probes: u8,
pmtud_max_probes: u8, pmtud_pkts_between_probes: usize,
) {
for (_, path) in self.paths.iter_mut() {
path.pmtud = if discover {
Some(pmtud::Pmtud::new(
max_send_udp_payload_size,
pmtud_max_probes,
pmtud_pkts_between_probes,
))
} else {
None
Expand Down
Loading