From 2cfe44f13e103d354d8df57bedda5704390ce9cf Mon Sep 17 00:00:00 2001 From: Adam Frisby Date: Sun, 24 May 2009 02:07:54 +0000 Subject: * Mono sucks. (Fixes crash due to Mono not implementing NetworkInformation.IPv4Mask aka Subnet masks) --- OpenSim/Framework/NetworkUtil.cs | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'OpenSim/Framework') diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs index 3ea5ac5..eeb514e 100644 --- a/OpenSim/Framework/NetworkUtil.cs +++ b/OpenSim/Framework/NetworkUtil.cs @@ -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) -- cgit v1.1