[omniORB] endPointPublishAllIFs?

Guy Middleton guy@certaintysolutions.com
Tue Sep 3 15:39:01 2002


On Mon, Aug 26, 2002 at 07:31:40PM +0100, Duncan Grisby wrote:
> On Wednesday 21 August, Guy Middleton wrote:
> 
> > Meanwhile, another dumb question: what's wrong with my endPoint?
> > 
> > I have this in my config file:
> > 
> > 	endPoint = giop:tcp:127.0.0.1:
> > 
> > eg2_impl says this:
> > 
> > 	omniORB: Error: Unable to create an endpoint of this description: giop:tcp:127.0.0.1:
> > 	Caught CORBA::SystemException.
> 
> Weird. It should work. I can only think that your machine is set up
> wrongly. Does ifconfig list the loopback interface?

Aha, I found the problem, which appears to be peculiar to FreeBSD.

Most Unixes don't care about the sin_zero field in a struct sockaddr, but
FreeBSD apparently does.  This patch fixes the problem:


--- src/lib/omniORB/orbcore/tcp/tcpEndpoint.cc	Mon Aug 26 23:37:09 2002
+++ src/lib/omniORB/orbcore/tcp/tcpEndpoint.cc.new	Mon Aug 26 23:35:38 2002
@@ -167,9 +167,11 @@
     }
   }
 
+  addr.sin_len = sizeof(struct sockaddr_in);
   addr.sin_family = INETSOCKET;
   addr.sin_addr.s_addr = INADDR_ANY;
   addr.sin_port = htons(pd_address.port);
+  memset((void *)&addr.sin_zero, 0, sizeof(addr.sin_zero));
 
   if ((char*)pd_address.host && strlen(pd_address.host) != 0) {
     LibcWrapper::hostent_var h;


FreeBSD also has a sin_len field, which most other Unixes don't, so you would
need to do an #ifdef somewhere for that.  However, it seems to work without
setting sin_len, so it may not be necessary.