-
Notifications
You must be signed in to change notification settings - Fork 4.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
improve handling of LLA in Quic (#90455)
* QUIC LLA * update * linux * line * update * Update src/libraries/Common/src/System/Net/IPEndPointExtensions.cs Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com> --------- Co-authored-by: Marie Píchová <11718369+ManickaP@users.noreply.github.com>
- Loading branch information
Showing
8 changed files
with
83 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 38 additions & 2 deletions
40
src/libraries/Common/tests/System/Net/Configuration.Sockets.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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<object[]> 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(); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters