In the OpenORB config file (default.xml), there are
settings to determine the hostname/IP address that is
published in IORs (iiop.hostname and iiop.publishIP),
and a setting to determine the hostname/IP address
that the ORB will listen on (iiop.listenAddress).
These settings are used in
org.openorb.orb.iiop.IIOPTransportServerInitializer.
On a multi-homed host, if listenAddress is set to the
default of 0.0.0.0 (meaning listen on all local IP
addresses for the host), then the current code is
fine, as any address returned by
InetAddress.getLocalHost() would be valid to publish
in the IORs.
However if listenAddress is set to a specific
interface's IP address/hostname for a multi-homed
host, then the InetAddress.getLocalHost() call will
not necessarily return the same address (the one it
picks is JVM implementation specific). If it returns
a different address, then the address published in
the IORs do not point to the address the ORB is
actually listening on, and so the ORB cannot be
connected to through these published IORs.
I've changed IIOPTransportServerInitializer to fix
this in the following way
1) Read the iiop.listenAddress property before the
iiop.publishIP property.
2) If iiop.hostname is not set, and
iiop.listenAddress is 0.0.0.0, then use the
iiop.publishIP setting as before.
3) If iiop.hostname is not set, and
iiop.listenAddress is not 0.0.0.0, ignore the
publishIP setting and publish the listenAddress in
IORs.
4) If iiop.hostname is set, use this in IORs. If
iiop.listenAddress is not 0.0.0.0, log a warning if
it does not match the iiop.hostname setting.
I've also changed the descriptions of the
iiop.publishIP and iiop.listenAddress properties in
default.xml to indicate when their values are
overridden.
diff file