This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Allow interface names in IPv6 link-local addresses #35278
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
0a4eb5c
Handle interface names in ipv6 addresses (link-local)
EgorBo 7c86a81
fix test projects
EgorBo a013304
Address feedback
EgorBo d0cb7b2
Add SetLastError to if_nametoindex
EgorBo a579f40
fix tests
EgorBo eadf307
fix tests
EgorBo 35cea64
Add more tests
EgorBo 333fed9
move native impl to pal_networking.c/h
EgorBo 0ae85cf
add newlines to pal_networking
EgorBo c82c16c
fix build
EgorBo cdcfa61
Merge remote-tracking branch 'dotnet/master' into fix-ipv6-link-local…
EgorBo ea3ee89
Merge remote-tracking branch 'dotnet/master' into fix-ipv6-link-local…
EgorBo 3055439
remove "Vista" comment from Interop.if_nametoindex.cs
EgorBo 6f1d812
Merge remote-tracking branch 'origin/master' into fix-ipv6-link-local…
EgorBo 93bbedb
test fix for Uri.cs
EgorBo dea4807
undo changes
EgorBo 43f8b19
Always return 0 for if_nametoindex on UAP
EgorBo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
15 changes: 15 additions & 0 deletions
15
src/Common/src/Interop/Unix/System.Native/Interop.InterfaceNameToIndex.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 |
---|---|---|
@@ -0,0 +1,15 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class Sys | ||
{ | ||
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_InterfaceNameToIndex", SetLastError = true)] | ||
public static extern unsafe uint InterfaceNameToIndex(string name); | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
src/Common/src/Interop/Windows/IpHlpApi/Interop.if_nametoindex.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 |
---|---|---|
@@ -0,0 +1,19 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
using System; | ||
using System.Runtime.InteropServices; | ||
|
||
internal static partial class Interop | ||
{ | ||
internal static partial class IpHlpApi | ||
{ | ||
#if !uap | ||
[DllImport(Interop.Libraries.IpHlpApi, SetLastError = true)] | ||
internal extern static uint if_nametoindex(string name); | ||
#else | ||
internal static uint if_nametoindex(string name) => 0; | ||
#endif | ||
} | ||
} |
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
14 changes: 14 additions & 0 deletions
14
src/Common/src/System/Net/NetworkInformation/InterfaceInfoPal.Unix.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace System.Net.NetworkInformation | ||
{ | ||
internal static class InterfaceInfoPal | ||
{ | ||
public static uint InterfaceNameToIndex(string interfaceName) | ||
{ | ||
return Interop.Sys.InterfaceNameToIndex(interfaceName); | ||
} | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
src/Common/src/System/Net/NetworkInformation/InterfaceInfoPal.Windows.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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for more information. | ||
|
||
namespace System.Net.NetworkInformation | ||
{ | ||
internal static class InterfaceInfoPal | ||
{ | ||
public static uint InterfaceNameToIndex(string interfaceName) | ||
{ | ||
return Interop.IpHlpApi.if_nametoindex(interfaceName); | ||
} | ||
} | ||
} |
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
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks like this isn't available in UWP, which is why a few of the legs are failing with a BCL0015 error. It'll need to be conditionally used when not building for that configuration.