* Mono sucks. (Fixes crash due to Mono not implementing NetworkInformation.IPv4Mask aka Subnet masks)
parent
ac79ff8dc6
commit
2cfe44f13e
|
@ -144,19 +144,26 @@ namespace OpenSim.Framework
|
|||
|
||||
static NetworkUtil()
|
||||
{
|
||||
foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
|
||||
try
|
||||
{
|
||||
foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses)
|
||||
foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
|
||||
{
|
||||
if (address.Address.AddressFamily == AddressFamily.InterNetwork)
|
||||
foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses)
|
||||
{
|
||||
if (address.IPv4Mask != null)
|
||||
if (address.Address.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
m_subnets.Add(address.Address, address.IPv4Mask);
|
||||
if (address.IPv4Mask != null)
|
||||
{
|
||||
m_subnets.Add(address.Address, address.IPv4Mask);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (NotImplementedException)
|
||||
{
|
||||
// Mono Sucks.
|
||||
}
|
||||
}
|
||||
|
||||
public static IPAddress GetIPFor(IPEndPoint user, string defaultHostname)
|
||||
|
|
Loading…
Reference in New Issue