--- 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