diff options
author | Diva Canto | 2010-08-19 09:14:20 -0700 |
---|---|---|
committer | Diva Canto | 2010-08-19 09:14:20 -0700 |
commit | 2b172bef7263a7301722a319e93e9066eff6ea76 (patch) | |
tree | 07f222d5f9d16fbef0c290ab7610ad1c0505f6f1 /OpenSim/Framework | |
parent | Merge branch 'master' of melanie@opensimulator.org:/var/git/opensim (diff) | |
download | opensim-SC_OLD-2b172bef7263a7301722a319e93e9066eff6ea76.zip opensim-SC_OLD-2b172bef7263a7301722a319e93e9066eff6ea76.tar.gz opensim-SC_OLD-2b172bef7263a7301722a319e93e9066eff6ea76.tar.bz2 opensim-SC_OLD-2b172bef7263a7301722a319e93e9066eff6ea76.tar.xz |
Revert "One more go at GetExternalIpOf(user). Addresses mantis #4955 and #4943."
Reverting mostly because of the texture asset files that got committed and cause grief with the 0.7-post-fixes branch. But also because I'm going to go at those mantises in another way.
This reverts commit e47608fc62647a28be91dd9caf6e446826fdb54c.
Diffstat (limited to 'OpenSim/Framework')
-rw-r--r-- | OpenSim/Framework/NetworkUtil.cs | 68 |
1 files changed, 28 insertions, 40 deletions
diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs index 5649131..831ff70 100644 --- a/OpenSim/Framework/NetworkUtil.cs +++ b/OpenSim/Framework/NetworkUtil.cs | |||
@@ -274,48 +274,36 @@ namespace OpenSim.Framework | |||
274 | } | 274 | } |
275 | } | 275 | } |
276 | 276 | ||
277 | // Check for private networks | 277 | // Check for same LAN segment |
278 | if (user.ToString().StartsWith("192.168")) | 278 | foreach (KeyValuePair<IPAddress, IPAddress> subnet in m_subnets) |
279 | { | 279 | { |
280 | m_log.Info("[NetworkUtil] Private network user detected, sending '" + externalIPAddress + "' instead of '" + user + "'"); | 280 | byte[] subnetBytes = subnet.Value.GetAddressBytes(); |
281 | return externalIPAddress; | 281 | byte[] localBytes = subnet.Key.GetAddressBytes(); |
282 | } | 282 | byte[] destBytes = user.GetAddressBytes(); |
283 | |||
284 | if (subnetBytes.Length != destBytes.Length || subnetBytes.Length != localBytes.Length) | ||
285 | return user; | ||
286 | |||
287 | bool valid = true; | ||
288 | |||
289 | for (int i = 0; i < subnetBytes.Length; i++) | ||
290 | { | ||
291 | if ((localBytes[i] & subnetBytes[i]) != (destBytes[i] & subnetBytes[i])) | ||
292 | { | ||
293 | valid = false; | ||
294 | break; | ||
295 | } | ||
296 | } | ||
297 | |||
298 | if (subnet.Key.AddressFamily != AddressFamily.InterNetwork) | ||
299 | valid = false; | ||
283 | 300 | ||
284 | // We may need to do more fancy configuration-based checks... I'm not entirely sure there is | 301 | if (valid) |
285 | // a 100% algorithmic manner of dealing with all the network setups out there. This code | 302 | { |
286 | // will evolve as people bump into problems. | 303 | m_log.Info("[NetworkUtil] Local LAN user detected, sending '" + externalIPAddress + "' instead of '" + user + "'"); |
287 | 304 | return externalIPAddress; | |
288 | //// Check for same LAN segment -- I don't think we want to do this in general. Leaving it here | 305 | } |
289 | //// for now as a reminder | 306 | } |
290 | //foreach (KeyValuePair<IPAddress, IPAddress> subnet in m_subnets) | ||
291 | //{ | ||
292 | // byte[] subnetBytes = subnet.Value.GetAddressBytes(); | ||
293 | // byte[] localBytes = subnet.Key.GetAddressBytes(); | ||
294 | // byte[] destBytes = user.GetAddressBytes(); | ||
295 | |||
296 | // if (subnetBytes.Length != destBytes.Length || subnetBytes.Length != localBytes.Length) | ||
297 | // return user; | ||
298 | |||
299 | // bool valid = true; | ||
300 | |||
301 | // for (int i = 0; i < subnetBytes.Length; i++) | ||
302 | // { | ||
303 | // if ((localBytes[i] & subnetBytes[i]) != (destBytes[i] & subnetBytes[i])) | ||
304 | // { | ||
305 | // valid = false; | ||
306 | // break; | ||
307 | // } | ||
308 | // } | ||
309 | |||
310 | // if (subnet.Key.AddressFamily != AddressFamily.InterNetwork) | ||
311 | // valid = false; | ||
312 | |||
313 | // if (valid) | ||
314 | // { | ||
315 | // m_log.Info("[NetworkUtil] Local LAN user detected, sending '" + externalIPAddress + "' instead of '" + user + "'"); | ||
316 | // return externalIPAddress; | ||
317 | // } | ||
318 | //} | ||
319 | 307 | ||
320 | // Otherwise, return user address | 308 | // Otherwise, return user address |
321 | return user; | 309 | return user; |