From 538b7252e8b186024c29f73195406000cf4c5a7d Mon Sep 17 00:00:00 2001 From: wfurt Date: Fri, 11 Aug 2023 11:32:41 -0700 Subject: [PATCH 1/6] QUIC LLA --- .../src/System/Net/IPEndPointExtensions.cs | 3 +- .../tests/System/Net/Configuration.Sockets.cs | 40 ++++++++++++++++++- .../System/Net/Http/HttpClientHandlerTest.cs | 4 +- .../tests/System/Net/Http/TestHelper.cs | 14 ------- .../System/Net/Quic/Internal/MsQuicHelpers.cs | 1 + .../src/System/Net/Quic/QuicListener.cs | 5 +++ .../FunctionalTests/QuicConnectionTests.cs | 26 ++++++++---- .../System.Net.Quic.Functional.Tests.csproj | 1 + 8 files changed, 69 insertions(+), 25 deletions(-) diff --git a/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs b/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs index 0e242e592fab1e..e911342dee1057 100644 --- a/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs +++ b/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs @@ -17,7 +17,8 @@ public static IPAddress GetIPAddress(ReadOnlySpan socketAddressBuffer) Span address = stackalloc byte[IPAddressParserStatics.IPv6AddressBytes]; uint scope; SocketAddressPal.GetIPv6Address(socketAddressBuffer, address, out scope); - return new IPAddress(address, (long)scope); + // Clear scope if set for anything byt LLA + return new IPAddress(address, ((address[0] & 0xFFC0) == 0xFE80) ? (long)scope : 0); } else if (family == AddressFamily.InterNetwork) { diff --git a/src/libraries/Common/tests/System/Net/Configuration.Sockets.cs b/src/libraries/Common/tests/System/Net/Configuration.Sockets.cs index 0e70009e544ce1..f9f9ba1dc17e5d 100644 --- a/src/libraries/Common/tests/System/Net/Configuration.Sockets.cs +++ b/src/libraries/Common/tests/System/Net/Configuration.Sockets.cs @@ -1,15 +1,51 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Generic; +using System.Linq; +using System.Net; +using System.Net.Sockets; +using System.Net.NetworkInformation; + namespace System.Net.Test.Common { public static partial class Configuration { public static partial class Sockets { - public static Uri SocketServer => GetUriValue("DOTNET_TEST_NET_SOCKETS_SERVERURI", new Uri("http://" + DefaultAzureServer)); + public static Uri SocketServer => GetUriValue("DOTNET_TEST_NET_SOCKETS_SERVERURI", new Uri("http://" + DefaultAzureServer)); + + public static string InvalidHost => GetValue("DOTNET_TEST_NET_SOCKETS_INVALIDSERVER", "notahostname.invalid.corp.microsoft.com"); + + public static IPAddress? LinkLocalAddress => GetIPv6LinkLocalAddress(); + + public static IEnumerable LocalAddresses() + { + if (LinkLocalAddress != null) + { + yield return new[] { LinkLocalAddress }; + } + if (Socket.OSSupportsIPv4) + { + yield return new[] { IPAddress.Loopback }; + } + if (Socket.OSSupportsIPv6) + { + yield return new[] { IPAddress.IPv6Loopback }; + } + } - public static string InvalidHost => GetValue("DOTNET_TEST_NET_SOCKETS_INVALIDSERVER", "notahostname.invalid.corp.microsoft.com"); + private static IPAddress GetIPv6LinkLocalAddress() => + NetworkInterface + .GetAllNetworkInterfaces() + .Where(i => !i.Description.StartsWith("PANGP Virtual Ethernet")) // This is a VPN adapter, but is reported as a regular Ethernet interface with + // a valid link-local address, but the link-local address doesn't actually work. + // So just manually filter it out. + .Where(i => !i.Name.Contains("Tailscale")) // Same as PANGP above. + .SelectMany(i => i.GetIPProperties().UnicastAddresses) + .Select(a => a.Address) + .Where(a => a.IsIPv6LinkLocal) + .FirstOrDefault(); } } } diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs index d92baef2828671..fe4c61a9577b6c 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.cs @@ -18,6 +18,8 @@ namespace System.Net.Http.Functional.Tests { + using Configuration = System.Net.Test.Common.Configuration; + #if WINHTTPHANDLER_TEST using HttpClientHandler = System.Net.Http.WinHttpClientHandler; #endif @@ -168,7 +170,7 @@ public async Task GetAsync_IPv6LinkLocalAddressUri_Success() using HttpClientHandler handler = CreateHttpClientHandler(allowAllCertificates: true); using HttpClient client = CreateHttpClient(handler); - var options = new GenericLoopbackOptions { Address = TestHelper.GetIPv6LinkLocalAddress() }; + var options = new GenericLoopbackOptions { Address = Configuration.Sockets.LinkLocalAddress }; if (options.Address == null) { throw new SkipTestException("Unable to find valid IPv6 LL address."); diff --git a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs index 1866f6a26cd115..c1d7a047070e6c 100644 --- a/src/libraries/Common/tests/System/Net/Http/TestHelper.cs +++ b/src/libraries/Common/tests/System/Net/Http/TestHelper.cs @@ -2,8 +2,6 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; -using System.Linq; -using System.Net.NetworkInformation; using System.Net.Security; using System.Security.Cryptography; using System.Security.Cryptography.X509Certificates; @@ -104,18 +102,6 @@ public static Task WhenAllCompletedOrAnyFailedWithTimeout(int timeoutInMilliseco public static Func AllowAllCertificates = (_, __, ___, ____) => true; #endif - public static IPAddress GetIPv6LinkLocalAddress() => - NetworkInterface - .GetAllNetworkInterfaces() - .Where(i => !i.Description.StartsWith("PANGP Virtual Ethernet")) // This is a VPN adapter, but is reported as a regular Ethernet interface with - // a valid link-local address, but the link-local address doesn't actually work. - // So just manually filter it out. - .Where(i => !i.Name.Contains("Tailscale")) // Same as PANGP above. - .SelectMany(i => i.GetIPProperties().UnicastAddresses) - .Select(a => a.Address) - .Where(a => a.IsIPv6LinkLocal) - .FirstOrDefault(); - public static byte[] GenerateRandomContent(int size) { byte[] data = new byte[size]; diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicHelpers.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicHelpers.cs index 0f925d65db3ecf..a4f18569e742f7 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicHelpers.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicHelpers.cs @@ -43,6 +43,7 @@ internal static unsafe IPEndPoint QuicAddrToIPEndPoint(QuicAddr* quicAddress, Ad { SocketAddressPal.SetAddressFamily(addressBytes, (AddressFamily)addressFamilyOverride!); } + return IPEndPointExtensions.CreateIPEndPoint(addressBytes); } diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs index fcbfba56336acc..dd5cec74eaabf1 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs @@ -158,6 +158,11 @@ private unsafe QuicListener(QuicListenerOptions options) // Get the actual listening endpoint. address = GetMsQuicParameter(_handle, QUIC_PARAM_LISTENER_LOCAL_ADDRESS); LocalEndPoint = MsQuicHelpers.QuicAddrToIPEndPoint(&address, options.ListenEndPoint.AddressFamily); + if (options.ListenEndPoint.Address.IsIPv6LinkLocal && LocalEndPoint.Address.ScopeId == 0) + { + +// LocalEndPoint.Address.ScopeId = options.ListenEndPoint.Address.ScopeId; + } } /// diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs index 6d04d3df863d9a..30f9ef0505ad61 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs @@ -12,20 +12,28 @@ namespace System.Net.Quic.Tests { + using Configuration = System.Net.Test.Common.Configuration; + [Collection(nameof(DisableParallelization))] [ConditionalClass(typeof(QuicTestBase), nameof(QuicTestBase.IsSupported))] public sealed class QuicConnectionTests : QuicTestBase { const int ExpectedErrorCode = 1234; + //const object[][] LocalAddresses = Configuration.Sockets.LocalAddresses(); + public static IEnumerable LocalAddresses = Configuration.Sockets.LocalAddresses(); public QuicConnectionTests(ITestOutputHelper output) : base(output) { } [Theory] - [InlineData(false)] - [InlineData(true)] - public async Task TestConnect(bool ipv6) + //[InlineData(false)] + //[InlineData(true)] + [MemberData(nameof(LocalAddresses))] + public async Task TestConnect(IPAddress address) { - await using QuicListener listener = await CreateQuicListener(ipv6 ? IPAddress.IPv6Loopback : IPAddress.Loopback); + await using QuicListener listener = await CreateQuicListener(address); + + Assert.Equal(address, listener.LocalEndPoint.Address); + Console.WriteLine("Created Listened with {0} -> {1}", address, listener.LocalEndPoint); var options = CreateQuicClientOptions(listener.LocalEndPoint); ValueTask connectTask = CreateQuicConnection(options); @@ -36,9 +44,13 @@ public async Task TestConnect(bool ipv6) await using QuicConnection clientConnection = connectTask.Result; IgnoreScopeIdIPEndpointComparer endPointComparer = new(); - Assert.Equal(listener.LocalEndPoint, serverConnection.LocalEndPoint, endPointComparer); - Assert.Equal(listener.LocalEndPoint, clientConnection.RemoteEndPoint, endPointComparer); - Assert.Equal(clientConnection.LocalEndPoint, serverConnection.RemoteEndPoint, endPointComparer); + Console.WriteLine("LocalEndPoint {0} Remote {1}", listener.LocalEndPoint, serverConnection.LocalEndPoint); + Console.WriteLine("Client {0} {1}", clientConnection.LocalEndPoint, clientConnection.RemoteEndPoint); + Console.WriteLine("Server {0} {1}", serverConnection.LocalEndPoint, serverConnection.RemoteEndPoint); + + Assert.Equal(listener.LocalEndPoint, serverConnection.LocalEndPoint); + Assert.Equal(listener.LocalEndPoint, clientConnection.RemoteEndPoint); + Assert.Equal(clientConnection.LocalEndPoint, serverConnection.RemoteEndPoint); Assert.Equal(ApplicationProtocol.ToString(), clientConnection.NegotiatedApplicationProtocol.ToString()); Assert.Equal(ApplicationProtocol.ToString(), serverConnection.NegotiatedApplicationProtocol.ToString()); Assert.Equal(options.ClientAuthenticationOptions.TargetHost, clientConnection.TargetHostName); diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj index 55ddd30f86abbb..67faecde3b4c9f 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/System.Net.Quic.Functional.Tests.csproj @@ -24,6 +24,7 @@ + From 9c466356981fe38ce3ee33438b817390f45e74c0 Mon Sep 17 00:00:00 2001 From: wfurt Date: Fri, 11 Aug 2023 21:45:21 -0700 Subject: [PATCH 2/6] update --- .../src/System/Net/IPEndPointExtensions.cs | 5 ++-- .../FunctionalTests/IPGlobalPropertiesTest.cs | 4 +--- .../NetworkInterfaceBasicTest.cs | 23 +++++++++++++++++++ 3 files changed, 27 insertions(+), 5 deletions(-) diff --git a/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs b/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs index e911342dee1057..2965d382edcdd2 100644 --- a/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs +++ b/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs @@ -17,8 +17,9 @@ public static IPAddress GetIPAddress(ReadOnlySpan socketAddressBuffer) Span address = stackalloc byte[IPAddressParserStatics.IPv6AddressBytes]; uint scope; SocketAddressPal.GetIPv6Address(socketAddressBuffer, address, out scope); - // Clear scope if set for anything byt LLA - return new IPAddress(address, ((address[0] & 0xFFC0) == 0xFE80) ? (long)scope : 0); + + // Clear scope if set for anything but LLA + return new IPAddress(address, (address[0] == 0xFE && (address[1] & 0xC0) == 0x80) ? (long)scope : 0); } else if (family == AddressFamily.InterNetwork) { diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs index 87775923829108..ce7500c0e2fbc2 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/IPGlobalPropertiesTest.cs @@ -2,11 +2,9 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.Collections.Generic; -using System.Net; using System.Net.Sockets; -using System.Net.Test.Common; using System.Threading.Tasks; - +using Microsoft.DotNet.XUnitExtensions; using Xunit; using Xunit.Abstractions; diff --git a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs index 14b5d9ffaf1d1f..dcb12e8b7f87b0 100644 --- a/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs +++ b/src/libraries/System.Net.NetworkInformation/tests/FunctionalTests/NetworkInterfaceBasicTest.cs @@ -304,5 +304,28 @@ public async Task NetworkInterface_LoopbackInterfaceIndex_MatchesReceivedPackets ipv6 ? NetworkInterface.IPv6LoopbackInterfaceIndex : NetworkInterface.LoopbackInterfaceIndex); } } + + [ConditionalFact] + public void NetworkInterface_UnicastLLA_ScopeIdSet() + { + bool foundLla = false; + foreach (NetworkInterface nic in NetworkInterface.GetAllNetworkInterfaces()) + { + IPInterfaceProperties prop = nic.GetIPProperties(); + foreach (UnicastIPAddressInformation info in prop.UnicastAddresses) + { + if (info.Address.IsIPv6LinkLocal) + { + foundLla = true; + Assert.NotEqual(0, info.Address.ScopeId); + } + } + } + + if (!foundLla) + { + throw new SkipTestException("Did not find any LLA"); + } + } } } From fc30b8b6fe9d3d6147a6cdd0376d06eb866a12bd Mon Sep 17 00:00:00 2001 From: wfurt Date: Fri, 11 Aug 2023 21:54:48 -0700 Subject: [PATCH 3/6] linux --- .../src/System/Net/Quic/QuicListener.cs | 3 +-- .../FunctionalTests/QuicConnectionTests.cs | 26 +++---------------- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs index dd5cec74eaabf1..7f22771b1dd9cf 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs @@ -160,8 +160,7 @@ private unsafe QuicListener(QuicListenerOptions options) LocalEndPoint = MsQuicHelpers.QuicAddrToIPEndPoint(&address, options.ListenEndPoint.AddressFamily); if (options.ListenEndPoint.Address.IsIPv6LinkLocal && LocalEndPoint.Address.ScopeId == 0) { - -// LocalEndPoint.Address.ScopeId = options.ListenEndPoint.Address.ScopeId; + LocalEndPoint.Address.ScopeId = options.ListenEndPoint.Address.ScopeId; } } diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs index 30f9ef0505ad61..3239b2cec59bfa 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs @@ -19,21 +19,16 @@ namespace System.Net.Quic.Tests public sealed class QuicConnectionTests : QuicTestBase { const int ExpectedErrorCode = 1234; - //const object[][] LocalAddresses = Configuration.Sockets.LocalAddresses(); public static IEnumerable LocalAddresses = Configuration.Sockets.LocalAddresses(); public QuicConnectionTests(ITestOutputHelper output) : base(output) { } [Theory] - //[InlineData(false)] - //[InlineData(true)] [MemberData(nameof(LocalAddresses))] public async Task TestConnect(IPAddress address) { await using QuicListener listener = await CreateQuicListener(address); - Assert.Equal(address, listener.LocalEndPoint.Address); - Console.WriteLine("Created Listened with {0} -> {1}", address, listener.LocalEndPoint); var options = CreateQuicClientOptions(listener.LocalEndPoint); ValueTask connectTask = CreateQuicConnection(options); @@ -43,31 +38,18 @@ public async Task TestConnect(IPAddress address) await using QuicConnection serverConnection = acceptTask.Result; await using QuicConnection clientConnection = connectTask.Result; - IgnoreScopeIdIPEndpointComparer endPointComparer = new(); - Console.WriteLine("LocalEndPoint {0} Remote {1}", listener.LocalEndPoint, serverConnection.LocalEndPoint); - Console.WriteLine("Client {0} {1}", clientConnection.LocalEndPoint, clientConnection.RemoteEndPoint); - Console.WriteLine("Server {0} {1}", serverConnection.LocalEndPoint, serverConnection.RemoteEndPoint); - Assert.Equal(listener.LocalEndPoint, serverConnection.LocalEndPoint); Assert.Equal(listener.LocalEndPoint, clientConnection.RemoteEndPoint); - Assert.Equal(clientConnection.LocalEndPoint, serverConnection.RemoteEndPoint); + if (PlatformDetection.IsWindows && address.IsIPv6LinkLocal) + { + Assert.Equal(clientConnection.LocalEndPoint, serverConnection.RemoteEndPoint); + } Assert.Equal(ApplicationProtocol.ToString(), clientConnection.NegotiatedApplicationProtocol.ToString()); Assert.Equal(ApplicationProtocol.ToString(), serverConnection.NegotiatedApplicationProtocol.ToString()); Assert.Equal(options.ClientAuthenticationOptions.TargetHost, clientConnection.TargetHostName); Assert.Equal(options.ClientAuthenticationOptions.TargetHost, serverConnection.TargetHostName); } - private class IgnoreScopeIdIPEndpointComparer : IEqualityComparer - { - public bool Equals(IPEndPoint x, IPEndPoint y) - { - byte[] xBytes = x.Address.GetAddressBytes(); - byte[] yBytes = y.Address.GetAddressBytes(); - return xBytes.AsSpan().SequenceEqual(yBytes) && x.Port == y.Port; - } - public int GetHashCode([DisallowNull] IPEndPoint obj) => obj.Port; - } - private static async Task OpenAndUseStreamAsync(QuicConnection c) { QuicStream s = await c.OpenOutboundStreamAsync(QuicStreamType.Bidirectional); From 4795653fe77b6644e536dd66ab470c5929814e6f Mon Sep 17 00:00:00 2001 From: wfurt Date: Fri, 11 Aug 2023 22:01:47 -0700 Subject: [PATCH 4/6] line --- .../src/System/Net/Quic/Internal/MsQuicHelpers.cs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicHelpers.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicHelpers.cs index a4f18569e742f7..0f925d65db3ecf 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicHelpers.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/Internal/MsQuicHelpers.cs @@ -43,7 +43,6 @@ internal static unsafe IPEndPoint QuicAddrToIPEndPoint(QuicAddr* quicAddress, Ad { SocketAddressPal.SetAddressFamily(addressBytes, (AddressFamily)addressFamilyOverride!); } - return IPEndPointExtensions.CreateIPEndPoint(addressBytes); } From c015653fd57ad1fedf2ecdfd4c38e1f9d80a10d3 Mon Sep 17 00:00:00 2001 From: wfurt Date: Sat, 12 Aug 2023 09:52:11 -0700 Subject: [PATCH 5/6] update --- .../System.Net.Quic/src/System/Net/Quic/QuicListener.cs | 4 ---- .../tests/FunctionalTests/QuicConnectionTests.cs | 1 + 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs index 7f22771b1dd9cf..fcbfba56336acc 100644 --- a/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs +++ b/src/libraries/System.Net.Quic/src/System/Net/Quic/QuicListener.cs @@ -158,10 +158,6 @@ private unsafe QuicListener(QuicListenerOptions options) // Get the actual listening endpoint. address = GetMsQuicParameter(_handle, QUIC_PARAM_LISTENER_LOCAL_ADDRESS); LocalEndPoint = MsQuicHelpers.QuicAddrToIPEndPoint(&address, options.ListenEndPoint.AddressFamily); - if (options.ListenEndPoint.Address.IsIPv6LinkLocal && LocalEndPoint.Address.ScopeId == 0) - { - LocalEndPoint.Address.ScopeId = options.ListenEndPoint.Address.ScopeId; - } } /// diff --git a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs index 3239b2cec59bfa..dba45d813945ff 100644 --- a/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs +++ b/src/libraries/System.Net.Quic/tests/FunctionalTests/QuicConnectionTests.cs @@ -42,6 +42,7 @@ public async Task TestConnect(IPAddress address) Assert.Equal(listener.LocalEndPoint, clientConnection.RemoteEndPoint); if (PlatformDetection.IsWindows && address.IsIPv6LinkLocal) { + // https://github.com/microsoft/msquic/issues/3813 Assert.Equal(clientConnection.LocalEndPoint, serverConnection.RemoteEndPoint); } Assert.Equal(ApplicationProtocol.ToString(), clientConnection.NegotiatedApplicationProtocol.ToString()); From e33f24c7c82bac0b1d47bb8adf5056be25704e93 Mon Sep 17 00:00:00 2001 From: Tomas Weinfurt Date: Mon, 14 Aug 2023 13:58:05 -0700 Subject: [PATCH 6/6] Update src/libraries/Common/src/System/Net/IPEndPointExtensions.cs MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com> --- src/libraries/Common/src/System/Net/IPEndPointExtensions.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs b/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs index 2965d382edcdd2..d4a48060e3cc5b 100644 --- a/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs +++ b/src/libraries/Common/src/System/Net/IPEndPointExtensions.cs @@ -18,7 +18,7 @@ public static IPAddress GetIPAddress(ReadOnlySpan socketAddressBuffer) uint scope; SocketAddressPal.GetIPv6Address(socketAddressBuffer, address, out scope); - // Clear scope if set for anything but LLA + // Clear scope if set for anything but Link Local address (always starts with fe80 first 10bits). return new IPAddress(address, (address[0] == 0xFE && (address[1] & 0xC0) == 0x80) ? (long)scope : 0); } else if (family == AddressFamily.InterNetwork)