Skip to content

HTTP/3: QUIC connection listener fixes #35258

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

Merged
merged 5 commits into from
Aug 12, 2021
Merged

Conversation

JamesNK
Copy link
Member

@JamesNK JamesNK commented Aug 11, 2021

ListenAnyIP passes an EndPoint with an address of IPAddress.IPv6Any to the transports. If there are multiple transports, i.e. TCP and multiplexed QUIC, then the address value was being replaced with an address that looks like IPv6Any, but isn't the IPAddress.IPv6Any constant. QuicConnectionListener has logic that checks for this constant.

Now the original address of a listener is always passed unchanged to each transport. The overall endpoint can be updated by the first transport when an ephemeral port (port 0) is bound. We want to share that.

@Tratcher
Copy link
Member

Quic should be checking for equivalence, not constant instances. Wouldn't you get the same issue if someone passes in [::] from config? This mitigation won't help in that case. File a bug to fix MsQuicAddressHelpers and link to it in your workaround. We should be able to remove the workaround afterward that's fixed.

@JamesNK
Copy link
Member Author

JamesNK commented Aug 11, 2021

I thought of a better fix that solves this (until fixed in system.net.quic) for all binding/configuration types.

@@ -35,8 +35,21 @@ public QuicConnectionListener(QuicTransportOptions options, IQuicTrace log, EndP
_context = new QuicTransportContext(_log, options);
var quicListenerOptions = new QuicListenerOptions();

var listenEndPoint = (IPEndPoint)endpoint;
Copy link
Member

Choose a reason for hiding this comment

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

Lol, you half-fixed #35200. Want to add the real exception now or wait?

Copy link
Member Author

Choose a reason for hiding this comment

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

Might as well.

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member

@Tratcher Tratcher left a comment

Choose a reason for hiding this comment

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

Much better.

@@ -49,7 +49,7 @@ public async Task BindAsync_NoServerCertificate_Error()
var ex = await Assert.ThrowsAsync<InvalidOperationException>(() => quicTransportFactory.BindAsync(new IPEndPoint(0, 0), features: features, cancellationToken: CancellationToken.None).AsTask()).DefaultTimeout();

// Assert
Assert.Equal("SslServerAuthenticationOptions.ServerCertificate must be configured with a value.", ex.Message);
Assert.Equal("SslServerAuthenticationOptions must provide a server certificate using ServerCertificate, ServerCertificateContext, or ServerCertificateSelectionCallback.", ex.Message);
Copy link
Member

Choose a reason for hiding this comment

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

Thanks, I missed this test in my last change.

@JamesNK JamesNK changed the title HTTP/3: Fix binding listener that shares transports with ListenAnyIP HTTP/3: QUIC connection listener fixes Aug 12, 2021
@JamesNK JamesNK merged commit 9c2b65a into main Aug 12, 2021
@JamesNK JamesNK deleted the jamesnk/http3-shared-listenanyip branch August 12, 2021 03:46
@ghost ghost added this to the 6.0-rc1 milestone Aug 12, 2021
@amcasey amcasey added area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions and removed area-runtime labels Jun 6, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-networking Includes servers, yarp, json patch, bedrock, websockets, http client factory, and http abstractions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants