Sorting list of DC addresses by closest first

Christopher R. Hertel crh at
Wed Apr 21 03:12:33 GMT 2004

Richard Sharpe wrote:
> Hi,
> We are having a problem with our internal infrastructure and our attempts
> to move to using Samba on our NAS to host internal CIFS usage.
> We have offices in TX, PA, and CA, with DCs in each of those offices. The
> PDC is in TX.
> When we first tried to cut over to using Samba member servers, all
> authentication traffic was going to TX, even in that from PA and CA.
> It seems to me that when get_dc_list is called, the list should be sorted
> with those addresses that are in the same subnets as the member server
> first on the list (perhaps permuted each time if there is more than one)
> and the remaining addresses next on the list, perhaps again permuted as
> they are used.
> Has anyone thought of the need for this behavior?

I have considered it for other reasons.

An important point, however, is that the the PDC is identified (in part) by
the fact that it is the first in the list.  This is an annoying quirk of MS
WINS behavior that Samba mimics.  When you send a domain<1C> query to an MS
WINS server, the list of IPs returned has the PDC IP first and the rest of
the <1C> IPs (registered by BDCs) are sorted by most-recently-renewed first.

I don't know what it is that depends on this behavior, but it's only in the
WINS response.  If you can sort the list on the receiving (client) end then
you're golden.

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