diff options
author | Adam Frisby | 2009-05-24 02:07:54 +0000 |
---|---|---|
committer | Adam Frisby | 2009-05-24 02:07:54 +0000 |
commit | 2cfe44f13e103d354d8df57bedda5704390ce9cf (patch) | |
tree | d07993bd3e4ed8a8c4c092e14894452d3069d00e /OpenSim/Framework | |
parent | * Adds NAT routing support for MXP Asset Delivery. (This means MXP should be ... (diff) | |
download | opensim-SC-2cfe44f13e103d354d8df57bedda5704390ce9cf.zip opensim-SC-2cfe44f13e103d354d8df57bedda5704390ce9cf.tar.gz opensim-SC-2cfe44f13e103d354d8df57bedda5704390ce9cf.tar.bz2 opensim-SC-2cfe44f13e103d354d8df57bedda5704390ce9cf.tar.xz |
* Mono sucks. (Fixes crash due to Mono not implementing NetworkInformation.IPv4Mask aka Subnet masks)
Diffstat (limited to 'OpenSim/Framework')
-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) |