Hello,

I got a Linux box, running samba-3.0.11 on a Windows network, controlled by
Windows Servers (I'm not the system administrator :-)).
My team make a lot of developments in this Linux box and I configured it to
provide file-sharing to some windows clients.

But I've noticed a lot of log messages like this:

[2005/02/20 04:14:56, 0] nmbd/nmbd_namequery.c:query_name_response(101)
query_name_response: Multiple (2) responses received for a query on subnet
172.16.67.176 for name MYDOMAIN<1d>.


When I do a nmblookup, I got this:

$> nmblookup -M MYDOMAIN
querying MYDOMAIN on 172.16.127.255
172.16.127.90 MYDOMAIN<1d>
172.16.127.90 MYDOMAIN<1d>


I know that MYDOMAIN got two name servers for reduncy, so when a query is
made, I got two responses with the same IP address.
But I think this is not an erroneous behaviour. So, when I got two (or more)
responses with the same IP, nmbd shouldn't log an error.

With this on my mind, I patched nmbd_namequery.c so that don't log if got two
(or more) responses with the same IP address.
I submit the patch to you, for your analysis, approval and possibly include it
on future samba releases.
I need to keep the last IP received, so I put it on a global variable
(last_answer_ip). You will probably need to put it in a better place.


Thanks for your time,

Filipe Henriques


Here is the patch:

--- samba-3.0.11.org/source/nmbd/nmbd_namequery.c Mon Oct 25 22:05:05
2004
+++ samba-3.0.11.new/source/nmbd/nmbd_namequery.c Mon Mar 7 12:32:11
2005
@@ -23,6 +23,10 @@

#include "includes.h"

+/* -ffh 2005-2-23 (Filipe Henriques):
+ Keep record of last response. */
+struct in_addr last_answer_ip;
+
/************************************************** **************************
Deal with a response packet when querying a name.
************************************************** **************************/
@@ -83,7 +87,11 @@
success = True;

putip((char *)&answer_ip,&nmb->answers->rdata[2]);
-
+
+ /* -ffh 2005-2-23 (Filipe Henriques):
+ Keep record of this response. */
+ putip((char *)&last_answer_ip,&nmb->answers->rdata[2]);
+
if( DEBUGLVL( 5 ) ) {
dbgtext( "query_name_response: On subnet %s ",
subrec->subnet_name );
dbgtext( "- positive response from IP %s ",
inet_ntoa(p->ip) );
@@ -97,8 +105,14 @@
*/
}
} else if( rrec->num_msgs > 1) {
+ /* More than one response. */

- if( DEBUGLVL( 0 ) ) {
+ /* -ffh 2005-2-23 (Filipe Henriques):
+ If this response answered the same IP address,
+ then that's because the network got reduncy servers
+ responding to this query.
+ Ignore, unless high debug level or diferent IP address. */
+ if( DEBUGLVL( 5 ) || ( (memcmp (&last_answer_ip, &nmb->answers-
>rdata[2], 4) != 0) && DEBUGLVL( 0 ) ) ) {

if (nmb->answers)
putip( (char *)&answer_ip, &nmb->answers->rdata
[2] );
dbgtext( "query_name_response: " );
@@ -107,6 +121,7 @@
dbgtext( "for name %s.\nThis response ", nmb_namestr
(question_name) );
dbgtext( "was from IP %s, reporting ", inet_ntoa(p-
>ip) );

dbgtext( "an IP address of %s.\n", inet_ntoa
(answer_ip) );
+ dbgtext( "Previous response reported an IP address of %
s.\n", inet_ntoa(last_answer_ip) );
}

/* We have already called the success or fail function, so we