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

feat(s2n-quic): allow disabling active connection migration support #2182

Merged
merged 12 commits into from
Apr 17, 2024

Conversation

WesleyRosenblum
Copy link
Contributor

Description of changes:

This change adds a with_connection_migration(enabled: bool) setting to the default connection limiter provider. When set to false, the disable_active_migration transport parameter will be sent to the peer, and any attempt by the peer to perform an active connection migration will be ignored.

The definition of "active connection migration" is the peer sending from a different source address while also changing the destination connection ID it was using previously. This is in contrast to a passive cnonection migration (caused by a NAT rebind or similar), where the peer would not know its source address changed, and thus would not change the destination connection ID.

Call-outs:

I went back and forth on whether this belonged in the path migration validator provider, but ultimately decided against it since:

  1. The path migration validator provider is not currently exposed as an option when building an endpoint
  2. Even if it was exposed, the logic of determining if a connection migration attempt was "active" or not is not something that should be left up to the application, as it is internal to QUIC.

Testing:

Added unit tests

Is this a refactor change? If so, how have you proved that the intended behavior hasn't changed? -->

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

///
/// If set to false, the `disable_active_migration` transport parameter will be sent to the
/// peer, and any attempt by the peer to perform an active connection migration will be ignored.
pub fn with_connection_migration(mut self, enabled: bool) -> Result<Self, ValidationError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does it make sense to expose a non-exhaustive enum here instead if its functionally equivalent?

Imagining a wild future where this gets expanded to other values (maybe not):

  • allow active mig (covered in this api)
  • deny active mig (covered in this api)
  • deny passive mig
  • allow up to 5 active mig
  • allow active mig from these IPs
  • ..etc

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to call this with_active_connection_migration, since we're not completely disabling migration, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, I went back and forth on that a bit. I think I ended up on thinking that the application shouldn't be too concerned about "passive" connection migration, so I left the "active" out of it. But thinking about it, its more obviously related to the disable_active_migration transport parameter with active in it, so I can add it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Regarding the wild future you are talking about @toidiu, I think at that point we would have to stabilize the path migration validator and add more of the configuration in there. This one is really tied to the transport parameter, which doesn't have any of that configurability

///
/// If set to false, the `disable_active_migration` transport parameter will be sent to the
/// peer, and any attempt by the peer to perform an active connection migration will be ignored.
pub fn with_connection_migration(mut self, enabled: bool) -> Result<Self, ValidationError> {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think it would be better to call this with_active_connection_migration, since we're not completely disabling migration, right?

Comment on lines 856 to 858
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum MigrationSupport {
#[default]
Copy link
Contributor

Choose a reason for hiding this comment

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

why did we need to change this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@WesleyRosenblum
Copy link
Contributor Author

Kani failures will be fixed by model-checking/kani#3144

toidiu
toidiu previously approved these changes Apr 16, 2024
quic/s2n-quic-transport/src/path/manager/tests.rs Outdated Show resolved Hide resolved
Co-authored-by: toidiu <[email protected]>
@WesleyRosenblum WesleyRosenblum merged commit 23b07e4 into main Apr 17, 2024
122 of 126 checks passed
@WesleyRosenblum WesleyRosenblum deleted the WesleyRosenblum/activemigration branch April 17, 2024 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants