Skip to content

Commit

Permalink
fix: Make neqo pass amplificationlimit QNS test
Browse files Browse the repository at this point in the history
  • Loading branch information
larseggert committed Jul 17, 2024
1 parent 735be28 commit c495ce4
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 10 deletions.
17 changes: 10 additions & 7 deletions neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl Connection {
NeqoQlog::default(),
now,
);
c.setup_handshake_path(&Rc::new(RefCell::new(path)), now);
c.setup_handshake_path(&Rc::new(RefCell::new(path)));
Ok(c)
}

Expand Down Expand Up @@ -1450,7 +1450,7 @@ impl Connection {
}

if self.state == State::WaitInitial {
self.start_handshake(path, packet, now);
self.start_handshake(path, packet);
}

if self.state.connected() {
Expand All @@ -1462,6 +1462,10 @@ impl Connection {
// We only allow one path during setup, so apply handshake
// path validation to this path.
path.borrow_mut().set_valid(now);
} else if self.role == Role::Client && packet.packet_type() == PacketType::Initial {
// If we are a client and we receive an Initial packet, we can
// assume that the server has validated the path.
path.borrow_mut().set_valid(now);
}
}

Expand Down Expand Up @@ -1644,7 +1648,7 @@ impl Connection {
/// During connection setup, the first path needs to be setup.
/// This uses the connection IDs that were provided during the handshake
/// to setup that path.
fn setup_handshake_path(&mut self, path: &PathRef, now: Instant) {
fn setup_handshake_path(&mut self, path: &PathRef) {
self.paths.make_permanent(
path,
Some(self.local_initial_source_cid.clone()),
Expand All @@ -1658,7 +1662,6 @@ impl Connection {
.clone(),
),
);
path.borrow_mut().set_valid(now);
}

/// If the path isn't permanent, assign it a connection ID to make it so.
Expand Down Expand Up @@ -1697,15 +1700,15 @@ impl Connection {
// First try to fill in handshake details.
if packet.packet_type() == PacketType::Initial {
self.remote_initial_source_cid = Some(ConnectionId::from(packet.scid()));
self.setup_handshake_path(path, now);
self.setup_handshake_path(path);
} else {
// Otherwise try to get a usable connection ID.
mem::drop(self.ensure_permanent(path));
}
}
}

fn start_handshake(&mut self, path: &PathRef, packet: &PublicPacket, now: Instant) {
fn start_handshake(&mut self, path: &PathRef, packet: &PublicPacket) {
qtrace!([self], "starting handshake");
debug_assert_eq!(packet.packet_type(), PacketType::Initial);
self.remote_initial_source_cid = Some(ConnectionId::from(packet.scid()));
Expand All @@ -1714,7 +1717,7 @@ impl Connection {
self.cid_manager
.add_odcid(self.original_destination_cid.as_ref().unwrap().clone());
// Make a path on which to run the handshake.
self.setup_handshake_path(path, now);
self.setup_handshake_path(path);

self.zero_rtt_state = match self.crypto.enable_0rtt(self.version, self.role) {
Ok(true) => {
Expand Down
6 changes: 4 additions & 2 deletions neqo-transport/src/recovery/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -893,7 +893,9 @@ impl LossRecovery {
}
self.stats.borrow_mut().lost += lost_packets.len();

self.maybe_fire_pto(primary_path.borrow().rtt(), now, &mut lost_packets);
if primary_path.borrow().is_valid() {
self.maybe_fire_pto(primary_path.borrow().rtt(), now, &mut lost_packets);
}
lost_packets
}

Expand Down Expand Up @@ -922,7 +924,7 @@ impl LossRecovery {
} else {
SendProfile::new_limited(mtu)
}
} else if sender.recovery_packet() {
} else if path.is_valid() && sender.recovery_packet() {
// After entering recovery, allow a packet to be sent immediately.
// This uses the PTO machinery, probing in all spaces. This will
// result in a PING being sent in every active space.
Expand Down
2 changes: 1 addition & 1 deletion qns/interop.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ server)
-name "$CERT" -passout pass: -out "$P12CERT"
pk12util -d "sql:$DB" -i "$P12CERT" -W ''
certutil -L -d "sql:$DB" -n "$CERT"
RUST_LOG=info RUST_BACKTRACE=1 neqo-server --cc cubic --qns-test "$TESTCASE" \
RUST_LOG=debug RUST_BACKTRACE=1 neqo-server --cc cubic --qns-test "$TESTCASE" \
--qlog-dir "$QLOGDIR" -d "$DB" -k "$CERT" '[::]:443' 2> >(tee -i -a "/logs/$ROLE.log" >&2)
;;

Expand Down

0 comments on commit c495ce4

Please sign in to comment.