diff options
Diffstat (limited to 'OpenSim/Framework/NetworkUtil.cs')
-rw-r--r-- | OpenSim/Framework/NetworkUtil.cs | 17 |
1 files changed, 12 insertions, 5 deletions
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 | |||
144 | 144 | ||
145 | static NetworkUtil() | 145 | static NetworkUtil() |
146 | { | 146 | { |
147 | foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) | 147 | try |
148 | { | 148 | { |
149 | foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses) | 149 | foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces()) |
150 | { | 150 | { |
151 | if (address.Address.AddressFamily == AddressFamily.InterNetwork) | 151 | foreach (UnicastIPAddressInformation address in ni.GetIPProperties().UnicastAddresses) |
152 | { | 152 | { |
153 | if (address.IPv4Mask != null) | 153 | if (address.Address.AddressFamily == AddressFamily.InterNetwork) |
154 | { | 154 | { |
155 | m_subnets.Add(address.Address, address.IPv4Mask); | 155 | if (address.IPv4Mask != null) |
156 | { | ||
157 | m_subnets.Add(address.Address, address.IPv4Mask); | ||
158 | } | ||
156 | } | 159 | } |
157 | } | 160 | } |
158 | } | 161 | } |
159 | } | 162 | } |
163 | catch (NotImplementedException) | ||
164 | { | ||
165 | // Mono Sucks. | ||
166 | } | ||
160 | } | 167 | } |
161 | 168 | ||
162 | public static IPAddress GetIPFor(IPEndPoint user, string defaultHostname) | 169 | public static IPAddress GetIPFor(IPEndPoint user, string defaultHostname) |