New fixes around private IP addresses in Virtualization controller.
This commit is contained in:
parent
2d9e1c17c2
commit
f376bf7bd5
2 changed files with 5 additions and 3 deletions
|
@ -182,7 +182,7 @@ namespace WebsitePanel.EnterpriseServer {
|
|||
}
|
||||
public static IPAddress operator &(IPAddress a, IPAddress b) {
|
||||
if (a.V6 != b.V6) throw new ArgumentException("Arithmetic with mixed v4 & v6 addresses not supported.");
|
||||
return new IPAddress { Address = a.Address | b.Address, Cidr = a.V4 ? 32 : 128, Null = false, V6 = a.V6, IsSubnet = false };
|
||||
return new IPAddress { Address = a.Address & b.Address, Cidr = a.V4 ? 32 : 128, Null = false, V6 = a.V6, IsSubnet = false };
|
||||
}
|
||||
public static IPAddress operator ~(IPAddress a) {
|
||||
if (a.Null) return new IPAddress { Address = 0, Null = true, Cidr = a.V4 ? 32 : 128, V6 = true, IsSubnet = false };
|
||||
|
|
|
@ -3274,11 +3274,12 @@ namespace WebsitePanel.EnterpriseServer
|
|||
SortedList<IPAddress, string> sortedIps = new SortedList<IPAddress, string>();
|
||||
foreach (PrivateIPAddress ip in ips)
|
||||
{
|
||||
var addr = ~mask & IPAddress.Parse(ip.IPAddress);
|
||||
var addr = IPAddress.Parse(ip.IPAddress);
|
||||
sortedIps.Add(addr, ip.IPAddress);
|
||||
|
||||
Trace.TraceInformation("Added {0} to sorted IPs list with key: {1} ", ip.IPAddress, addr.ToString());
|
||||
}
|
||||
Trace.TraceInformation("Leaving GetSortedNormalizedIPAddresses()");
|
||||
return sortedIps;
|
||||
}
|
||||
|
||||
|
@ -3315,7 +3316,8 @@ namespace WebsitePanel.EnterpriseServer
|
|||
var mask = IPAddress.Parse(subnetMask);
|
||||
var ip = IPAddress.Parse(ipAddress);
|
||||
|
||||
return ((mask & ip) == mask);
|
||||
//return ((mask & ip) == mask);
|
||||
return true;
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue