Imported Upstream version 5.20.0.180

Former-commit-id: ff953ca879339fe1e1211f7220f563e1342e66cb
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2019-02-04 20:11:37 +00:00
parent 0e2d47d1c8
commit 0510252385
3360 changed files with 83827 additions and 39243 deletions

View File

@@ -44,13 +44,11 @@ namespace System.Net.NetworkInformation {
public override IPv4InterfaceProperties GetIPv4Properties ()
{
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
return new Win32IPv4InterfaceProperties (v4info, mib4);
return new Win32IPv4InterfaceProperties (addr, mib4);
}
public override IPv6InterfaceProperties GetIPv6Properties ()
{
Win32_IP_ADAPTER_INFO v6info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib6.Index);
return new Win32IPv6InterfaceProperties (mib6);
}
@@ -74,10 +72,9 @@ namespace System.Net.NetworkInformation {
public override IPAddressCollection DhcpServerAddresses {
get {
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
// FIXME: should ipv6 DhcpServer be considered?
try {
return new Win32IPAddressCollection (v4info.DhcpServer);
return Win32IPAddressCollection.FromSocketAddress (addr.Dhcpv4Server);
} catch (IndexOutOfRangeException) {
return Win32IPAddressCollection.Empty;
}
@@ -96,28 +93,17 @@ namespace System.Net.NetworkInformation {
get {
var col = new GatewayIPAddressInformationCollection ();
try {
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
// FIXME: should ipv6 DhcpServer be considered?
var a = v4info.GatewayList;
if (!String.IsNullOrEmpty (a.IpAddress)) {
col.InternalAdd(new SystemGatewayIPAddressInformation(IPAddress.Parse (a.IpAddress)));
AddSubsequently (a.Next, col);
Win32_IP_ADAPTER_GATEWAY_ADDRESS a;
for (IntPtr p = addr.FirstGatewayAddress; p != IntPtr.Zero; p = a.Next) {
a = (Win32_IP_ADAPTER_GATEWAY_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_GATEWAY_ADDRESS));
col.InternalAdd (new SystemGatewayIPAddressInformation (a.Address.GetIPAddress ()));
}
} catch (IndexOutOfRangeException) {}
return col;
}
}
static void AddSubsequently (IntPtr head, GatewayIPAddressInformationCollection col)
{
Win32_IP_ADDR_STRING a;
for (IntPtr p = head; p != IntPtr.Zero; p = a.Next) {
a = (Win32_IP_ADDR_STRING) Marshal.PtrToStructure (p, typeof (Win32_IP_ADDR_STRING));
col.InternalAdd (new SystemGatewayIPAddressInformation (IPAddress.Parse (a.IpAddress)));
}
}
public override bool IsDnsEnabled {
get { return Win32NetworkInterface.FixedInfo.EnableDns != 0; }
}
@@ -147,7 +133,6 @@ namespace System.Net.NetworkInformation {
public override UnicastIPAddressInformationCollection UnicastAddresses {
get {
try {
Win32_IP_ADAPTER_INFO ai = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
// FIXME: should ipv6 DhcpServer be considered?
return Win32FromUnicast (addr.FirstUnicastAddress);
} catch (IndexOutOfRangeException) {
@@ -170,9 +155,7 @@ namespace System.Net.NetworkInformation {
public override IPAddressCollection WinsServersAddresses {
get {
try {
Win32_IP_ADAPTER_INFO v4info = Win32NetworkInterface2.GetAdapterInfoByIndex (mib4.Index);
// FIXME: should ipv6 DhcpServer be considered?
return new Win32IPAddressCollection (v4info.PrimaryWinsServer, v4info.SecondaryWinsServer);
return Win32IPAddressCollection.FromWinsServer (addr.FirstWinsServerAddress);
} catch (IndexOutOfRangeException) {
return Win32IPAddressCollection.Empty;
}