Skip to content
Open
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
14 changes: 10 additions & 4 deletions quic/s2n-quic-core/src/path/migration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,10 +138,11 @@ pub mod default {
//# datagrams that match these patterns prior to validating the
//# destination address.

// NOTE: this may cause reachability issues if a peer or NAT use different
// port scopes for the same connection. Additional research may
// be required to determine if this countermeasure needs to be relaxed.
if PortScope::new(active_addr.port()) != PortScope::new(packet_addr.port()) {
let active_port_scope = PortScope::new(active_addr.port());
let packet_port_scope = PortScope::new(packet_addr.port());
if active_port_scope.is_system() != packet_port_scope.is_system() {
// Changing port scope from the system to a non-system (user or dynamic) scope
// and vice versa is rejected. Any other combination is allowed.
return Outcome::Deny(DenyReason::PortScopeChanged);
}

Expand Down Expand Up @@ -192,6 +193,11 @@ pub mod default {
49152..=65535 => Self::Dynamic,
}
}

#[inline]
pub fn is_system(&self) -> bool {
self == &PortScope::System
}
}

fn to_addr(addr: &SocketAddress) -> crate::inet::SocketAddress {
Expand Down
Loading