nmbd won't start after upgrade from 3.0.30.0 to 3.5.8.0 on AIX 6100-06-03-1048

Rolf Anders rolf.anders at rz.uni-augsburg.de
Thu Aug 11 12:40:41 MDT 2011


Hi John,

On Wed, Aug 03, 2011 at 04:17:03PM -0400, john.brunner at wcb.state.ny.us wrote:
> Used pware packaged version 3.5.8.0 from http://pware.hvcc.edu/ with all
> appropriate pware61 filesets.
> 
> nmbd process wouldn't start and received the following error in
> the /var/log/samba/log.nmbd.
> 
> [2011/08/02 12:56:49.162945,  0] lib/util_sock.c:875(open_socket_in)
>   bind failed on port 137 socket_addr = 172.20.95.239.
>   Error = The socket name is not available on this system.
> [2011/08/02 12:56:49.163276,  0] nmbd/nmbd_subnetdb.c:118(make_subnet)
>   nmbd_subnetdb:make_subnet()
>     Failed to open nmb bcast socket on interface 172.20.95.239 for port
> 137.  Error was The socket name is not available on this system.

I had the same problem some time ago. It seems to be caused by
sockaddr_dup() not allocating enough space. AIX has an sa_len field in
struct sockaddr but fills it with a rather low value when ioctl() is
called with SIOCGIFNETMASK.

E.g. if the netmask is 255.0.0.0, sa_len is set to 5 (tested with AIX
5.3.12).  Since the netmask starts at the 3rd byte of sa_data, and the
first 2 bytes of struct sockaddr are occupied by sa_len and sa_family,
5 bytes are just enough to hold the 1st byte of the netmask. In general it
seems that sa_len is set so that trailing 0-bytes of the netmask are not
contained in the first sa_len bytes of struct sockaddr. I'm not sure
whether this behavior is correct, i.e. whether the bug is in AIX or in
Samba.

I worked around this problem by patching sockaddr_dup() to always
allocate sizeof(struct sockaddr_storage) bytes (which is the default for
systems which have no sa_len field):

--- samba-3.5.8/lib/replace/getifaddrs.c.orig	2011-01-07 13:24:23.000000000 +0100
+++ samba-3.5.8/lib/replace/getifaddrs.c	2011-01-07 18:24:13.000000000 +0100
@@ -58,7 +58,7 @@
 {
 	struct sockaddr *ret;
 	socklen_t socklen;
-#ifdef HAVE_SOCKADDR_SA_LEN
+#if defined(HAVE_SOCKADDR_SA_LEN) && !defined(AIX)
 	socklen = sa->sa_len;
 #else
 	socklen = sizeof(struct sockaddr_storage);

Greetings,

Rolf

-- 
Rolf Anders ............................ http://www.rz.uni-augsburg.de
Universität Augsburg, Rechenzentrum ............. Tel. (0821) 598-2030
86135 Augsburg .................................. Fax. (0821) 598-2028
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 183 bytes
Desc: not available
URL: <http://lists.samba.org/pipermail/samba-technical/attachments/20110811/0c01867c/attachment.pgp>


More information about the samba-technical mailing list