Strategy for mapping the neighborhood

Christopher R. Hertel crh at
Wed Oct 29 23:01:59 GMT 2003

On Wed, Oct 29, 2003 at 12:33:22PM -0800, David Wuertele wrote:
> So I guess this means you had hosts on your LAN which did not register
> themselves with an LMB.  Why do you think that was?  They must have
> been B hosts, or they would have been unreachable, right?  Do B hosts
> sometimes not register?

You're confusing things.  B mode simply means "Broadcast" mode.  That is, 
the nodes register and query *names* using broadcast packets and do not 
communicate with the NBNS.

That has nothing to do with the LMB, which is listening for broadcasts.
Of course, the LMB is only listening for a specific kind of broadcast (not 
name registrations).

Note, once again, that nodes only register themselves with the Browse 
Service (via the LMB) if they have services to offer.

> Since B hosts' scope is restricted to the subnet, it seems to me that
> you could find them by calling the following libsmbclient fucntions:
>   ServerFD = open_socket_in (SOCK_DGRAM, 0, 3,
>                              interpret_addr(<my ip addr>), True);
>   set_socket_options (ServerFD, "SO_BROADCAST");
>   ip_list = name_query (ServerFD, star, 0, 1, 1,
>                         *bcast, &count, &flags, NULL);

Sending a broadcast query for the wildcard name.  Yes.  That should give 
you a list of IPs for all B, M, or H nodes on the local LAN.  Since the 
packets are UDP, there can be some gaps.  I typically send such a query 
three times and then sort -u the results.

> Of course, this will never find P hosts.  In fact, for some reason, it
> doesn't find some M or H hosts.  I'm not sure why.  Can anyone guess
> why an M or H host on the subnet would not be discovered by this code?

There are a few reasons.  I listed one above.  Another is that the 
"missing" nodes might be using a different ScopeID.

It's clear from what you have above that you've got the idea of P and B 
mode scopes.  Kewl (many people don't quite get that).  M and H mode 
should be the union of P and B scope.

Thing is, if you enter a ScopeID into the configuration then you further 
divide the NBT scope.  The ScopeID acts as a sort of vLAN tag.  The 
default is the nul scope: "".

Other than that, perhaps you need to listen longer for replies or send 
multiple queries to get the full list.  All nodes (except, as you point 
out, P nodes) should respond to the wildcard query.

Chris -)-----

"Implementing CIFS - the Common Internet FileSystem" ISBN: 013047116X
Samba Team --     -)-----   Christopher R. Hertel
jCIFS Team --   -)-----   ubiqx development, uninq.
ubiqx Team --     -)-----   crh at
OnLineBook --    -)-----   crh at

More information about the samba-technical mailing list