Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Replace find_path_with_rebinding with find_path #2176

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
2 changes: 1 addition & 1 deletion neqo-transport/src/connection/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1532,7 +1532,7 @@ impl Connection {
/// This takes two times: when the datagram was received, and the current time.
fn input(&mut self, d: &Datagram, received: Instant, now: Instant) {
// First determine the path.
let path = self.paths.find_path_with_rebinding(
let path = self.paths.find_path(
d.destination(),
d.source(),
self.conn_params.get_cc_algorithm(),
Expand Down
42 changes: 0 additions & 42 deletions neqo-transport/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -98,48 +98,6 @@ impl Paths {
})
}

/// Find the path, but allow for rebinding. That matches the pair of addresses
/// to paths that match the remote address only based on IP addres, not port.
/// We use this when the other side migrates to skip address validation and
/// creating a new path.
Comment on lines -103 to -104
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why did we previously skip address validation on port change?

If I understand RFC 9000 correctly, the port is always part of the validation process:

In path validation, endpoints test reachability between a specific local address and a specific peer address, where an address is the 2-tuple of IP address and port.

https://www.rfc-editor.org/rfc/rfc9000.html#section-8.2

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@martinthomson might know?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We did that deliberately, because if a peer changes just the port, it's probably just a NAT rebinding. No point in wasting the effort.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we care that that will make us violate the spec and fail a QNS test?

pub fn find_path_with_rebinding(
&self,
local: SocketAddr,
remote: SocketAddr,
cc: CongestionControlAlgorithm,
pacing: bool,
now: Instant,
) -> PathRef {
self.paths
.iter()
.find_map(|p| {
if p.borrow().received_on(local, remote, false) {
Some(Rc::clone(p))
} else {
None
}
})
.or_else(|| {
self.paths.iter().find_map(|p| {
if p.borrow().received_on(local, remote, true) {
larseggert marked this conversation as resolved.
Show resolved Hide resolved
Some(Rc::clone(p))
} else {
None
}
})
})
.unwrap_or_else(|| {
Rc::new(RefCell::new(Path::temporary(
local,
remote,
cc,
pacing,
self.qlog.clone(),
now,
)))
})
}

/// Get a reference to the primary path, if one exists.
pub fn primary(&self) -> Option<PathRef> {
self.primary.clone()
Expand Down
Loading