DMB registration bug: query sent from wrong interface

Steve Langasek vorlon at netexpress.net
Thu Oct 26 15:37:29 GMT 2000


Jean-Gabriel,

The attached patch fixed the problem for me. You might give it a try to see if
it solves your problem too.

This patch has also been applied to Samba CVS, so the fix should show up in
Samba 2.2.

Cheers,
Steve Langasek
postmodern programmer

> I'm running 5 Sambas on a host with 5 interfaces on 5 distinct subnets. When
> trying to sync browse lists between sambas, I've encountered the same problem
> that you described : queries to the wins server are sent from the wrong
> interface, so 4 of the 5 sambas never get the answers.

> Here is a quick hack that solves my problem (at least, it seems to work, for
> now :-)

> In the file samba-2.0.7/source/nmbd/nmbd_packets.c, line 225, I replaced :

>   packet->fd = ClientNMB;

> with :

>   packet->fd = subnetlist->nmb_sock;

> I hope it'll be useful, until samba gurus write something cleaner to fix the
> problem.
-------------- next part --------------
Index: nmbd_packets.c
===================================================================
RCS file: /cvsroot/samba/source/nmbd/nmbd_packets.c,v
retrieving revision 1.28.2.7
diff -u -w -r1.28.2.7 nmbd_packets.c
--- nmbd_packets.c	2000/05/02 04:49:55	1.28.2.7
+++ nmbd_packets.c	2000/08/30 01:49:38
@@ -699,6 +699,33 @@
 					  subrec->bcast_ip)) == NULL)
     return NULL;
 
+  if(lp_bind_interfaces_only())
+  {
+    int i;
+
+    DEBUG(10,("queue_query_name: bind_interfaces_only is set, looking for suitable source IP\n"));
+    for(i = 0; i < iface_count(); i++)
+    {
+      struct in_addr *ifip = iface_n_ip(i);
+
+      if(ifip == NULL)
+      {
+        DEBUG(0,("queue_query_name: interface %d has NULL IP address !\n", i));
+        continue;
+      }
+
+      if (ip_equal(*ifip,loopback_ip))
+      {
+	DEBUG(5,("queue_query_name: ignoring loopback interface (%d)\n", i));
+        continue;
+      }
+
+      DEBUG(10,("queue_query_name: using source IP %s\n",inet_ntoa(*ifip)));
+      p->fd = find_subnet_fd_for_address( *ifip );
+      break;
+    }
+  }
+
   if(initiate_name_query_packet( p ) == False)
   {
     p->locked = False;


More information about the samba-technical mailing list