[ openjms-Bugs-750870 ] Cannot bind to a specific interface

"SourceForge.net" <[email protected]>
Newsgroups gmane.comp.java.openjms.devel
Message-ID <[email protected]>
Bugs item #750870, was opened at 2003-06-08 20:27
Message generated for change (Comment added) made by tanderson
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=750870&group_id=54559

Category: server
Group: None
Status: Open
Resolution: None
Priority: 5
Submitted By: John Evans (lgas)
Assigned to: Tim Anderson (tanderson)
Summary: Cannot bind to a specific interface

Initial Comment:
I would like to be able to bind to specific interfaces, 
specifically 127.0.0.1, however it appears that this is 
not possible.  I looked briefly for where to make the 
changes and the only place I can find where a 
ServerSocket is even used is in the apache JNDI stuff.  
If someone can point me in the right direction to get me 
started I'll gladly make the changes and submit a patch.

----------------------------------------------------------------------

>Comment By: Tim Anderson (tanderson)
Date: 2003-06-21 20:56

Message:
Logged In: YES 
user_id=557161

You could add another property to the config file 
named 'bindAll' or something similar. If true, this result in the 
ServerSocket(port) constructor being called. If false, the 
ServerSocket(port, ... address) constructor would be used. It 
would default to true, to retain existing behaviour.

You'll need to modify 
src/main/org/exolab/jms/config/openjms.xsd to extend the 
config file. It would become an attribute of the 
<ServerConfiguration> element.

----------------------------------------------------------------------

Comment By: John Evans (lgas)
Date: 2003-06-20 20:08

Message:
Logged In: YES 
user_id=137603

I have the changes to openjms working as needed for my 
environment, however I'm trying to figure out how to handle 
it for the general case.  

Right now I use the host attribute of the ServerConfigurartion 
as the interface for JNDI to bind to, and if the server is using 
TCP mode, I use the internalHost attribute of the 
TcpConfiguration if present, otherwise, the host attribute of 
the ServerConfiguration as the interface for the TCP server 
to bind to.  I think this seems like the "right way" to do it, 
however this means that using the default configuration files, 
or any configuration files that existing users don't change 
(from "localhost" to "0.0.0.0") that the server will suddenly 
only bind to localhost (127.0.0.1) and not all interfaces.  
Obviously the existing configuration files can be changed to 
replace "localhost" with "0.0.0.0", however this will affect 
existing deployments, so I guess it's up to you how to 
proceed.  

If you like, I can submit my patches as-is, and let you figure 
it out, or if there is another way you'd like it handled I can go 
ahead and make the changes. 

An alternative would be to add seperate attributes specifying 
the interface to bind JNDI and the TCP server to, but it 
seems like this might clutter up the configuration file.

Let me know how you would like to proceed.

----------------------------------------------------------------------

Comment By: Tim Anderson (tanderson)
Date: 2003-06-19 16:00

Message:
Logged In: YES 
user_id=557161

Patches to exolabcore applied, thanks. Will you be submitting 
corresponding patches to openjms?


----------------------------------------------------------------------

Comment By: John Evans (lgas)
Date: 2003-06-19 05:43

Message:
Logged In: YES 
user_id=137603

Here are the patches to allow binding to a specific interface 
in the exolab core libraries.  

----------------------------------------------------------------------

Comment By: Tim Anderson (tanderson)
Date: 2003-06-17 10:45

Message:
Logged In: YES 
user_id=557161

Sure - the sources for exolabcore can be obtained as follows:
cvs -
d:pserver:[email protected]:/cvsroot/openjms 
login 
 
cvs -z3 -
d:pserver:[email protected]:/cvsroot/openjms 
co exolabcore



----------------------------------------------------------------------

Comment By: John Evans (lgas)
Date: 2003-06-17 02:43

Message:
Logged In: YES 
user_id=137603

It looks like maybe the connections are being created in the 
init() method of the org.exolab.jms.server.mipc.IpcJmsServer 
class through a call to the .createServer(int port) method 
which creates a new org.exolab.jms.server.mipc.IpcJmsServer 
which only has a single interface which just takes the port to 
listen on and the ConnectionNotifier to notify... so if I'm not 
mistaken, all of this stuff would have to be updated to take 
an optional address to bind to.  If the source is available for 
the exolabcore stuff, I'll take a shot at it....

----------------------------------------------------------------------

Comment By: John Evans (lgas)
Date: 2003-06-17 01:44

Message:
Logged In: YES 
user_id=137603

When I leave the host attribute of the ServerConfiguration 
parameter set to "localhost" (as it is by default) or set it 
explicitly to "127.0.0.1" as you tanderson suggested, the 
server binds to all interfaces on the machine (0.0.0.0) and 
not just 127.0.0.1.

I would like to be able to bind to JUST 127.0.0.1 (or the 
address of any other specific interface, instead of 0.0.0.0 
which is the address that maps to all interfaces).

Again, I'd be happy to make the changes but I have not yet 
found the place in the code where the binding is done, so any 
guidance would be helpful.

----------------------------------------------------------------------

Comment By: Tim Anderson (tanderson)
Date: 2003-06-08 23:17

Message:
Logged In: YES 
user_id=557161

I'm not exactly sure what you're trying to do, but you should 
be able to configure the server for 127.0.0.1. E.g,
in openjms.xml:

  <ServerConfiguration host="127.0.0.1"/>

As for the JNDI code - the part you're referring to isn't used 
by OpenJMS.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=474136&aid=750870&group_id=54559
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.