BUG: multiple nmbd including WINS on one machine (samba-2.0.7)

Jacek Konieczny jajcus at bnet.pl
Sun Dec 31 16:26:15 GMT 2000


Hi,

I wanted to setup several sambas on one machine. Each one serving for
one connected networks (there would be separate workgroup for each
network). One more samba would be a WINS server for all of them. The
problem is, that with unpatched samba 2.0.7 such configuration is
impossible. Only one nmbd would become master domain browser. It is
because all nmbd daemons use default address as source address of name
query sent to WINS. And the WINS won't accept queriers from itself.
I think thats because ClientNMB socket is used when nothing better is
found. But as it is written in nmbd.c:

  /* The sockets opened here will be used to receive broadcast
     packets *only*. Interface specific sockets are opened in
     make_subnet() in namedbsubnet.c. Thus we bind to the
     address "0.0.0.0". The parameter 'socket address' is
     now deprecated.
   */

it should be used for broadcast only.

A patch is attached, which fixes this (at least for me).
The patch makes nmbd use socked of FIRST_SUBNET instead of ClientNMB,
but INHO it would be better to use socket associated with address
given as "socket address" configuration option.

Greets,
        Jacek


-------------- next part --------------
diff -durN samba-2.0.7.orig/source/nmbd/nmbd_packets.c samba-2.0.7/source/nmbd/nmbd_packets.c
--- samba-2.0.7.orig/source/nmbd/nmbd_packets.c	Wed Apr 26 01:06:58 2000
+++ samba-2.0.7/source/nmbd/nmbd_packets.c	Sun Dec 31 17:05:04 2000
@@ -59,7 +59,7 @@
     if(ip_equal(local_ip, subrec->myip))
       return subrec->nmb_sock;
 
-  return ClientNMB;
+  return FIRST_SUBNET->nmb_sock;
 }
 
 /***************************************************************************
@@ -222,7 +222,7 @@
 
   packet->ip = to_ip;
   packet->port = NMB_PORT;
-  packet->fd = ClientNMB;
+  packet->fd = FIRST_SUBNET->nmb_sock;
   packet->timestamp = time(NULL);
   packet->packet_type = NMB_PACKET;
   packet->locked = False;


More information about the samba mailing list