mirror of
https://github.com/opensim/opensim.git
synced 2026-08-10 03:06:05 +08:00
* 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.
This commit is contained in:
@@ -73,9 +73,8 @@ namespace OpenSim.Framework
|
||||
|
||||
private static IPAddress GetExternalIPFor(IPAddress destination, string defaultHostname)
|
||||
{
|
||||
bool ipv6 = false;
|
||||
// Adds IPv6 Support (Not that any of the major protocols supports it...)
|
||||
if (ipv6 && destination.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
if (destination.AddressFamily == AddressFamily.InterNetworkV6)
|
||||
{
|
||||
foreach (IPAddress host in Dns.GetHostAddresses(defaultHostname))
|
||||
{
|
||||
@@ -91,10 +90,14 @@ namespace OpenSim.Framework
|
||||
return null;
|
||||
|
||||
// Check if we're accessing localhost.
|
||||
foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName()))
|
||||
foreach (KeyValuePair<IPAddress, IPAddress> pair in m_subnets)
|
||||
{
|
||||
IPAddress host = pair.Value;
|
||||
if (host.Equals(destination) && host.AddressFamily == AddressFamily.InterNetwork)
|
||||
{
|
||||
m_log.Info("[NATROUTING] Localhost user detected, sending them '" + host + "' instead of '" + defaultHostname + "'");
|
||||
return destination;
|
||||
}
|
||||
}
|
||||
|
||||
// Check for same LAN segment
|
||||
|
||||
Reference in New Issue
Block a user