socket support (bind) broken on solaris (by sockaddr_storage
changes?)
Jeremy Allison
jra at samba.org
Fri Nov 2 16:34:04 GMT 2007
On Fri, Nov 02, 2007 at 04:29:38PM +0100, Michael Adam wrote:
> 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?
It's just the bind calls - correct ? If so it's really
easy to fix.
The getnameinfo is mostly easy to fix. It's mainly called
though print_sockaddr, which doesn't take a socklen_t, so
we can just add the size calculation there.
Jeremy.
More information about the samba-technical
mailing list