diff options
author | Melanie | 2010-02-18 04:19:33 +0000 |
---|---|---|
committer | Melanie | 2010-02-18 04:19:33 +0000 |
commit | 842b68eeff7571d3c82415c65065bec3c95f34ea (patch) | |
tree | 5980e497c3f3fc5acb9bd549e4b050268a92f2b4 | |
parent | Revert "change "SYSTEMIP" to "localhost" in the create region console command... (diff) | |
download | opensim-SC_OLD-842b68eeff7571d3c82415c65065bec3c95f34ea.zip opensim-SC_OLD-842b68eeff7571d3c82415c65065bec3c95f34ea.tar.gz opensim-SC_OLD-842b68eeff7571d3c82415c65065bec3c95f34ea.tar.bz2 opensim-SC_OLD-842b68eeff7571d3c82415c65065bec3c95f34ea.tar.xz |
Change handling of the SYSTEMIP constant to be more sane.
This will now choose the first network interface IP address, or the loopback
interface if no external interfaces are found. It will log the IP address
used as [NETWORK]: Using x.x.x.x for SYSTEMIP.
-rw-r--r-- | OpenSim/Framework/RegionInfo.cs | 1 | ||||
-rw-r--r-- | OpenSim/Framework/Util.cs | 18 | ||||
-rwxr-xr-x | OpenSim/Region/Application/OpenSim.cs | 2 |
3 files changed, 14 insertions, 7 deletions
diff --git a/OpenSim/Framework/RegionInfo.cs b/OpenSim/Framework/RegionInfo.cs index 88b62e0..baef32a 100644 --- a/OpenSim/Framework/RegionInfo.cs +++ b/OpenSim/Framework/RegionInfo.cs | |||
@@ -487,7 +487,6 @@ namespace OpenSim.Framework | |||
487 | else | 487 | else |
488 | m_externalHostName = externalName; | 488 | m_externalHostName = externalName; |
489 | 489 | ||
490 | |||
491 | // Master avatar cruft | 490 | // Master avatar cruft |
492 | // | 491 | // |
493 | string masterAvatarUUID; | 492 | string masterAvatarUUID; |
diff --git a/OpenSim/Framework/Util.cs b/OpenSim/Framework/Util.cs index 7215086..48435cb 100644 --- a/OpenSim/Framework/Util.cs +++ b/OpenSim/Framework/Util.cs | |||
@@ -589,11 +589,17 @@ namespace OpenSim.Framework | |||
589 | 589 | ||
590 | public static IPAddress GetLocalHost() | 590 | public static IPAddress GetLocalHost() |
591 | { | 591 | { |
592 | string dnsAddress = "localhost"; | 592 | IPAddress[] iplist = GetLocalHosts(); |
593 | 593 | ||
594 | IPAddress[] hosts = Dns.GetHostEntry(dnsAddress).AddressList; | 594 | if (iplist.Length == 0) // No accessible external interfaces |
595 | { | ||
596 | IPAddress[] loopback = Dns.GetHostAddresses("localhost"); | ||
597 | IPAddress localhost = loopback[0]; | ||
595 | 598 | ||
596 | foreach (IPAddress host in hosts) | 599 | return localhost; |
600 | } | ||
601 | |||
602 | foreach (IPAddress host in iplist) | ||
597 | { | 603 | { |
598 | if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) | 604 | if (!IPAddress.IsLoopback(host) && host.AddressFamily == AddressFamily.InterNetwork) |
599 | { | 605 | { |
@@ -601,15 +607,15 @@ namespace OpenSim.Framework | |||
601 | } | 607 | } |
602 | } | 608 | } |
603 | 609 | ||
604 | if (hosts.Length > 0) | 610 | if (iplist.Length > 0) |
605 | { | 611 | { |
606 | foreach (IPAddress host in hosts) | 612 | foreach (IPAddress host in iplist) |
607 | { | 613 | { |
608 | if (host.AddressFamily == AddressFamily.InterNetwork) | 614 | if (host.AddressFamily == AddressFamily.InterNetwork) |
609 | return host; | 615 | return host; |
610 | } | 616 | } |
611 | // Well all else failed... | 617 | // Well all else failed... |
612 | return hosts[0]; | 618 | return iplist[0]; |
613 | } | 619 | } |
614 | 620 | ||
615 | return null; | 621 | return null; |
diff --git a/OpenSim/Region/Application/OpenSim.cs b/OpenSim/Region/Application/OpenSim.cs index 96eceb0..05e283e 100755 --- a/OpenSim/Region/Application/OpenSim.cs +++ b/OpenSim/Region/Application/OpenSim.cs | |||
@@ -190,6 +190,8 @@ namespace OpenSim | |||
190 | 190 | ||
191 | PrintFileToConsole("startuplogo.txt"); | 191 | PrintFileToConsole("startuplogo.txt"); |
192 | 192 | ||
193 | m_log.InfoFormat("[NETWORK]: Using {0} as SYSTEMIP", Util.GetLocalHost().ToString()); | ||
194 | |||
193 | // For now, start at the 'root' level by default | 195 | // For now, start at the 'root' level by default |
194 | if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it | 196 | if (m_sceneManager.Scenes.Count == 1) // If there is only one region, select it |
195 | ChangeSelectedRegion("region", | 197 | ChangeSelectedRegion("region", |