socket support (bind) broken on solaris (by sockaddr_storage changes?)

Michael Adam ma at sernet.de
Fri Nov 2 15:29:38 GMT 2007


Jeremy,

I found the problem:

Our data structures are ok. 
But Solaris' bind function will fail with EINVAL when the given
length is not precicely the length of the structure actually
hidden inside the struct sockaddr_storage:

We have to pass sizeof(struct sockaddr_in) for AF_INET and
so on to make it happy.

I found that out using debugging and testing but the man page 
even says so: 

	EINVAL		namelen is not the size of  a  valid
			address  for  the  specified address
			family.

According to the SUS, EINVAL should indicate the socket 
already being bound.

The failure of getnaminfo not returning any string for debug
output is the same (undocumented though): If I explicitly
pass a "sizeof(struct sockaddr_in)" to it, the debug message
succees.

So how should we go about this. Should we change the code to
always pass the exact size of the hidden structure, or is
lib/replace an option?

Cheers, Michael

Jeremy Allison wrote:
> On Fri, Nov 02, 2007 at 12:08:18AM +0100, Michael Adam wrote:
> 
> > I am attaching output of "truss sbin/nmbd -i -F -S".
> 
> Thanks. I'm guessing the output from interpret_string_addr
> of 0.0.0.0 is coming back with an invalid struct, which
> means getaddrinfo() is coming back with an invalid
> struct addrinfo * value. We might need to massage
> the value returned here inside interpret_string_addr()
> for Solaris.
> 
> > I will check tomorrow. For the time being, do you have
> > any hint as to what t check/alter?
> 
> I need to see this under gdb to look inside the
> structs returned.
> 
> Jeremy.


-- 
Michael Adam <ma at sernet.de>
SerNet GmbH, Bahnhofsallee 1b, 37081 Göttingen
phone: +49-551-370000-0, fax: +49-551-370000-9
AG Göttingen, HRB 2816, GF: Dr. Johannes Loxen
http://www.SerNet.DE, mailto: Info @ SerNet.DE


More information about the samba-technical mailing list