[SCM] Samba Shared Repository - branch master updated

Volker Lendecke vlendec at samba.org
Mon May 2 16:58:02 MDT 2011


The branch, master has been updated
       via  8da8c36 s3: Tune broadcast namequeries for unique names
      from  56cd3b3 s3-rpc_server: (re)move last globally included rpc_server prototypes.

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=master


- Log -----------------------------------------------------------------
commit 8da8c36b53cc115f0d446b666fc24fc9423d808e
Author: Volker Lendecke <vl at samba.org>
Date:   Mon May 2 23:35:06 2011 +0200

    s3: Tune broadcast namequeries for unique names
    
    If we get a unique name via a broadcast query, there's no point in waiting the
    full timeout. A unique name is just what its name says: unique. No point in
    waiting longer.
    
    Autobuild-User: Volker Lendecke <vlendec at samba.org>
    Autobuild-Date: Tue May  3 00:57:24 CEST 2011 on sn-devel-104

-----------------------------------------------------------------------

Summary of changes:
 source3/libsmb/namequery.c |   12 +++++++++---
 1 files changed, 9 insertions(+), 3 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source3/libsmb/namequery.c b/source3/libsmb/namequery.c
index 49b2061..4ce56e6 100644
--- a/source3/libsmb/namequery.c
+++ b/source3/libsmb/namequery.c
@@ -1253,6 +1253,7 @@ static bool name_query_validator(struct packet_struct *p, void *private_data)
 		private_data, struct name_query_state);
 	struct nmb_packet *nmb = &p->packet.nmb;
 	struct sockaddr_storage *tmp_addrs;
+	bool got_unique_netbios_name = false;
 	int i;
 
 	debug_nmb_packet(p);
@@ -1327,7 +1328,12 @@ static bool name_query_validator(struct packet_struct *p, void *private_data)
 		 "from %s ( ", inet_ntoa(p->ip)));
 
 	for (i=0; i<nmb->answers->rdlength/6; i++) {
+		uint16_t flags;
 		struct in_addr ip;
+
+		flags = RSVAL(&nmb->answers->rdata[i*6], 0);
+		got_unique_netbios_name |= ((flags & 0x8000) == 0);
+
 		putip((char *)&ip,&nmb->answers->rdata[2+i*6]);
 		in_addr_to_sockaddr_storage(
 			&state->addrs[state->num_addrs], ip);
@@ -1352,10 +1358,10 @@ static bool name_query_validator(struct packet_struct *p, void *private_data)
 
 	if (state->bcast) {
 		/*
-		 * We have to collect all entries coming in from
-		 * broadcast queries
+		 * We have to collect all entries coming in from broadcast
+		 * queries. If we got a unique name, we're done.
 		 */
-		return false;
+		return got_unique_netbios_name;
 	}
 	/*
 	 * WINS responses are accepted when they are received


-- 
Samba Shared Repository


More information about the samba-cvs mailing list