From 3046a0d7c29ad6a5bdafe763c90aa521ac8aa93a Mon Sep 17 00:00:00 2001 From: Samba Release Account Date: Sat, 8 Mar 1997 18:47:07 +0000 Subject: preferred master option will force an election every 5 minutes if the server isn't a preferred master, and DEBUG(0,(...)) this. reason: if the os level etc parameters aren't working properly, then a domain master browser samba server that _ought_ to be the local master browser as well might not. i'll modify smb.conf.5 man page etc to reflect this change. lkcl (This used to be commit ebaff730c9cb6d04049fd9901d46dcd758357e95) --- source3/nameelect.c | 59 ++++++++++++++++++++++++++++++++++------------------- 1 file changed, 38 insertions(+), 21 deletions(-) diff --git a/source3/nameelect.c b/source3/nameelect.c index 1c4f8e6390..9a15c0b112 100644 --- a/source3/nameelect.c +++ b/source3/nameelect.c @@ -56,33 +56,50 @@ extern uint16 nb_type; /* samba's NetBIOS name type */ ******************************************************************/ void check_master_browser(time_t t) { - static time_t lastrun=0; - struct subnet_record *d; - - if (!lastrun) lastrun = t; - if (t < lastrun + CHECK_TIME_MST_BROWSE * 60) - return; - lastrun = t; + static time_t lastrun=0; + struct subnet_record *d; - dump_workgroups(); + if (!lastrun) lastrun = t; + if (t < lastrun + CHECK_TIME_MST_BROWSE * 60) + return; + lastrun = t; - for (d = subnetlist; d; d = d->next) - { - struct work_record *work; + dump_workgroups(); - for (work = d->workgrouplist; work; work = work->next) + for (d = subnetlist; d; d = d->next) { - /* if we are not the browse master of a workgroup, and we can't - find a browser on the subnet, do something about it. */ + struct work_record *work; - if (!AM_MASTER(work)) - { - queue_netbios_packet(d,ClientNMB,NMB_QUERY,NAME_QUERY_MST_CHK, - work->work_group,0x1d,0,0,0,NULL,NULL, - True,False,d->bcast_ip,d->bcast_ip); - } + for (work = d->workgrouplist; work; work = work->next) + { + if (!AM_MASTER(work)) + { + if (lp_preferred_master()) + { + /* preferred master - not a master browser. force + becoming a master browser, hence the log message. + */ + + DEBUG(0,("%s preferred master for %s %s - force election\n", + timestring(), work->work_group, + inet_ntoa(d->bcast_ip))); + + browser_gone(work->work_group, d->bcast_ip); + } + else + { + /* if we are not the browse master of a workgroup, + and we can't find a browser on the subnet, do + something about it. + */ + + queue_netbios_packet(d,ClientNMB,NMB_QUERY,NAME_QUERY_MST_CHK, + work->work_group,0x1d,0,0,0,NULL,NULL, + True,False,d->bcast_ip,d->bcast_ip); + } + } + } } - } } -- cgit