Strategy for mapping the neighborhood

David Wuertele dave-gnus at bfnet.com
Wed Oct 29 20:33:22 GMT 2003


Daniel> When I was developing the Celery/Stalk search engine, I found
Daniel> I was unable to reliably map all reachable machines on a given
Daniel> subnet by crawling the hierarchy as you described.

Daniel> The approach I ended up using was to send an NMB ping to the
Daniel> subnet's broadcast address, and index the machines that
Daniel> responded. This approach was not 100% reliable either, but by
Daniel> re-broadcasting periodically and caching data from machines
Daniel> that did not respond to subsequent broadcasts, I was able to
Daniel> discover/track a fairly high percentage of available shares on
Daniel> my local network (across 4 subnets, using their 4 broadcast
Daniel> addresses).

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?

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

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?

Dave




More information about the samba-technical mailing list