aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Framework/NetworkUtil.cs
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/NetworkUtil.cs14
1 files changed, 11 insertions, 3 deletions
diff --git a/OpenSim/Framework/NetworkUtil.cs b/OpenSim/Framework/NetworkUtil.cs
index f9d9b89..d4fc1e2 100644
--- a/OpenSim/Framework/NetworkUtil.cs
+++ b/OpenSim/Framework/NetworkUtil.cs
@@ -57,6 +57,9 @@ namespace OpenSim.Framework
57 } 57 }
58 } 58 }
59 59
60 if (subnet.Key.AddressFamily != AddressFamily.InterNetwork)
61 valid = false;
62
60 if (valid) 63 if (valid)
61 { 64 {
62 m_log.Info("[NATROUTING] Local LAN user detected, sending them '" + subnet.Key + "' instead of '" + simulator + "'"); 65 m_log.Info("[NATROUTING] Local LAN user detected, sending them '" + subnet.Key + "' instead of '" + simulator + "'");
@@ -70,8 +73,9 @@ namespace OpenSim.Framework
70 73
71 private static IPAddress GetExternalIPFor(IPAddress destination, string defaultHostname) 74 private static IPAddress GetExternalIPFor(IPAddress destination, string defaultHostname)
72 { 75 {
76 bool ipv6 = false;
73 // Adds IPv6 Support (Not that any of the major protocols supports it...) 77 // Adds IPv6 Support (Not that any of the major protocols supports it...)
74 if (destination.AddressFamily == AddressFamily.InterNetworkV6) 78 if (ipv6 && destination.AddressFamily == AddressFamily.InterNetworkV6)
75 { 79 {
76 foreach (IPAddress host in Dns.GetHostAddresses(defaultHostname)) 80 foreach (IPAddress host in Dns.GetHostAddresses(defaultHostname))
77 { 81 {
@@ -89,7 +93,7 @@ namespace OpenSim.Framework
89 // Check if we're accessing localhost. 93 // Check if we're accessing localhost.
90 foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName())) 94 foreach (IPAddress host in Dns.GetHostAddresses(Dns.GetHostName()))
91 { 95 {
92 if (host.Equals(destination)) 96 if (host.Equals(destination) && host.AddressFamily == AddressFamily.InterNetwork)
93 return destination; 97 return destination;
94 } 98 }
95 99
@@ -114,6 +118,9 @@ namespace OpenSim.Framework
114 } 118 }
115 } 119 }
116 120
121 if (subnet.Key.AddressFamily != AddressFamily.InterNetwork)
122 valid = false;
123
117 if (valid) 124 if (valid)
118 { 125 {
119 m_log.Info("[NATROUTING] Local LAN user detected, sending them '" + subnet.Key + "' instead of '" + defaultHostname + "'"); 126 m_log.Info("[NATROUTING] Local LAN user detected, sending them '" + subnet.Key + "' instead of '" + defaultHostname + "'");
@@ -143,7 +150,8 @@ namespace OpenSim.Framework
143 if (address.IPv4Mask != null) 150 if (address.IPv4Mask != null)
144 { 151 {
145 m_subnets.Add(address.Address, address.IPv4Mask); 152 m_subnets.Add(address.Address, address.IPv4Mask);
146 } else 153 }
154 else
147 { 155 {
148 m_log.Warn("[NetworkUtil] Found IPv4 Address without Subnet Mask!?"); 156 m_log.Warn("[NetworkUtil] Found IPv4 Address without Subnet Mask!?");
149 } 157 }