Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorConrad Meyer <cse.cem@gmail.com>2019-05-27 10:21:07 +0300
committerMarek Safar <marek.safar@gmail.com>2019-05-27 10:21:07 +0300
commite2a21cbac3e4739c1383c06b75d45322843b686b (patch)
treea255911ef5eb9e4895d6992f02c10e1d4c201324 /mcs/class/System
parenta12749adb61201d5c6965fe943f90ef750d10746 (diff)
[System.Net.NetworkInformation] Fork FreeBSD from MacOs (#14619)
* [System.Net.NetworkInformation] Fork FreeBSD from MacOs They are related, but not identical. In particular, MacOS AF_INET6 is wrong on FreeBSD and breaks IPv6 networking on FreeBSD. Establish an inheritence relationship with overrides for now; it's possible more differences will be needed in the future. This change is released under the MIT license. * [csproj] Update project files
Diffstat (limited to 'mcs/class/System')
-rw-r--r--mcs/class/System/System.Net.NetworkInformation/FreeBSDNetworkInterface.cs36
-rw-r--r--mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterface.cs18
-rw-r--r--mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs4
-rw-r--r--mcs/class/System/System.csproj13
-rw-r--r--mcs/class/System/macos_networkinfo.sources1
5 files changed, 67 insertions, 5 deletions
diff --git a/mcs/class/System/System.Net.NetworkInformation/FreeBSDNetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/FreeBSDNetworkInterface.cs
new file mode 100644
index 00000000000..8cb61d7a79c
--- /dev/null
+++ b/mcs/class/System/System.Net.NetworkInformation/FreeBSDNetworkInterface.cs
@@ -0,0 +1,36 @@
+//
+// System.Net.NetworkInformation.NetworkInterface
+//
+// Authors:
+// Conrad Meyer (cem@FreeBSD.org)
+//
+// Copyright (c) 2019 Conrad Meyer
+//
+// Permission is hereby granted, free of charge, to any person obtaining
+// a copy of this software and associated documentation files (the
+// "Software"), to deal in the Software without restriction, including
+// without limitation the rights to use, copy, modify, merge, publish,
+// distribute, sublicense, and/or sell copies of the Software, and to
+// permit persons to whom the Software is furnished to do so, subject to
+// the following conditions:
+//
+// The above copyright notice and this permission notice shall be
+// included in all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
+// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
+// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
+// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
+// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
+// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
+//
+namespace System.Net.NetworkInformation {
+ internal class FreeBSDNetworkInterfaceAPI : MacOsNetworkInterfaceAPI
+ {
+ public FreeBSDNetworkInterfaceAPI ()
+ : base (AF_INET6: 28)
+ {
+ }
+ }
+}
diff --git a/mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterface.cs b/mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterface.cs
index 3f1fc06bc47..5f0b9213325 100644
--- a/mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterface.cs
+++ b/mcs/class/System/System.Net.NetworkInformation/MacOsNetworkInterface.cs
@@ -36,9 +36,19 @@ using System.Runtime.InteropServices;
namespace System.Net.NetworkInformation {
internal class MacOsNetworkInterfaceAPI : UnixNetworkInterfaceAPI
{
- const int AF_INET = 2;
- const int AF_INET6 = 30;
- const int AF_LINK = 18;
+ const int AF_INET = 2;
+ const int AF_LINK = 18;
+ protected readonly int AF_INET6;
+
+ public MacOsNetworkInterfaceAPI ()
+ {
+ AF_INET6 = 30;
+ }
+
+ protected MacOsNetworkInterfaceAPI (int AF_INET6)
+ {
+ this.AF_INET6 = AF_INET6;
+ }
public override NetworkInterface [] GetAllNetworkInterfaces ()
{
@@ -217,4 +227,4 @@ namespace System.Net.NetworkInformation {
}
}
}
-} \ No newline at end of file
+}
diff --git a/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs b/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs
index 48fe885abd8..b70f0c9e6dc 100644
--- a/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs
+++ b/mcs/class/System/System.Net.NetworkInformation/UnixNetworkInterfaceFactory.cs
@@ -43,8 +43,10 @@ namespace System.Net.NetworkInformation {
if (runningOnUnix) {
// XXX: OpenBSD and NetBSD too? It seems other platforms map closer to the Mac OS version than Linux,
// even if not exactly; it seems Linux and/or glibc are the different ones.
- if (Platform.IsMacOS || Platform.IsFreeBSD || Platform.IsOpenBSD)
+ if (Platform.IsMacOS || Platform.IsOpenBSD)
return new MacOsNetworkInterfaceAPI ();
+ if (Platform.IsFreeBSD)
+ return new FreeBSDNetworkInterfaceAPI ();
// XXX: IBM i would be better with its own API targetting Qp2getifaddrs
if (Platform.IsAix || Platform.IsIBMi)
diff --git a/mcs/class/System/System.csproj b/mcs/class/System/System.csproj
index b07267da366..1fcf28a8f07 100644
--- a/mcs/class/System/System.csproj
+++ b/mcs/class/System/System.csproj
@@ -1099,6 +1099,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -1316,6 +1317,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -1441,6 +1443,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -1562,6 +1565,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -2529,6 +2533,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -3038,6 +3043,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -3535,6 +3541,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -3666,6 +3673,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -3787,6 +3795,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -3921,6 +3930,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -4189,6 +4199,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -4327,6 +4338,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
@@ -4465,6 +4477,7 @@
<Compile Include="System.Net.NetworkInformation\AixIPv4InterfaceStatistics.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\AixNetworkInterfaceMarshal.cs" />
+ <Compile Include="System.Net.NetworkInformation\FreeBSDNetworkInterface.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPInterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceProperties.cs" />
<Compile Include="System.Net.NetworkInformation\LinuxIPv4InterfaceStatistics.cs" />
diff --git a/mcs/class/System/macos_networkinfo.sources b/mcs/class/System/macos_networkinfo.sources
index 8a03393938a..c263b162749 100644
--- a/mcs/class/System/macos_networkinfo.sources
+++ b/mcs/class/System/macos_networkinfo.sources
@@ -1,3 +1,4 @@
+System.Net.NetworkInformation/FreeBSDNetworkInterface.cs
System.Net.NetworkInformation/MacOsIPInterfaceProperties.cs
System.Net.NetworkInformation/MacOsIPv4InterfaceProperties.cs
System.Net.NetworkInformation/MacOsIPv4InterfaceStatistics.cs