aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/NetworkUtil.cs
diff options
context:
space:
mode:
authorAdam Frisby2009-05-23 07:51:29 +0000
committerAdam Frisby2009-05-23 07:51:29 +0000
commit70f6a2852eaea68bad0d26e5a5c1c7d8df3d8942 (patch)
treea430cb3dedf702f1294bdb8a9b14984ea6d15eb8 /OpenSim/Framework/NetworkUtil.cs
parent* Disables internal IPv6 Support - causing issues. (diff)
downloadopensim-SC-70f6a2852eaea68bad0d26e5a5c1c7d8df3d8942.zip
opensim-SC-70f6a2852eaea68bad0d26e5a5c1c7d8df3d8942.tar.gz
opensim-SC-70f6a2852eaea68bad0d26e5a5c1c7d8df3d8942.tar.bz2
opensim-SC-70f6a2852eaea68bad0d26e5a5c1c7d8df3d8942.tar.xz
* Fixes [irritating] edge case in Util.GetLocalHost which could return an IPv6 address if no non-loopback IPv4 address can be found.
* Restores internal IPv6 support to NetworkUtil.* * Fixes bad login unit tests.
Diffstat (limited to 'OpenSim/Framework/NetworkUtil.cs')
-rw-r--r--OpenSim/Framework/NetworkUtil.cs9
1 files changed, 6 insertions, 3 deletions
diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs
index d4fc1e2..328d3bc 100644
--- a/OpenSim/Framework/NetworkUtil.cs
+++ b/OpenSim/Framework/NetworkUtil.cs
@@ -73,9 +73,8 @@ namespace OpenSim.Framework
73 73
74 private static IPAddress GetExternalIPFor(IPAddress destination, string defaultHostname) 74 private static IPAddress GetExternalIPFor(IPAddress destination, string defaultHostname)
75 { 75 {
76 bool ipv6 = false;
77 // Adds IPv6 Support (Not that any of the major protocols supports it...) 76 // Adds IPv6 Support (Not that any of the major protocols supports it...)
78 if (ipv6 && destination.AddressFamily == AddressFamily.InterNetworkV6) 77 if (destination.AddressFamily == AddressFamily.InterNetworkV6)
79 { 78 {
80 foreach (IPAddress host in Dns.GetHostAddresses(defaultHostname)) 79 foreach (IPAddress host in Dns.GetHostAddresses(defaultHostname))
81 { 80 {
@@ -91,10 +90,14 @@ namespace OpenSim.Framework
91 return null; 90 return null;
92 91
93 // Check if we're accessing localhost. 92 // Check if we're accessing localhost.
94 foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName())) 93 foreach (KeyValuePair<IPAddress, IPAddress> pair in m_subnets)
95 { 94 {
95 IPAddress host = pair.Value;
96 if (host.Equals(destination) && host.AddressFamily == AddressFamily.InterNetwork) 96 if (host.Equals(destination) && host.AddressFamily == AddressFamily.InterNetwork)
97 {
98 m_log.Info("[NATROUTING] Localhost user detected, sending them '" + host + "' instead of '" + defaultHostname + "'");
97 return destination; 99 return destination;
100 }
98 } 101 }
99 102
100 // Check for same LAN segment 103 // Check for same LAN segment