diff options
author | Andrew Tridgell <tridge@samba.org> | 1996-06-08 04:41:51 +0000 |
---|---|---|
committer | Andrew Tridgell <tridge@samba.org> | 1996-06-08 04:41:51 +0000 |
commit | bfbca5ac7706d03056366b84b679faeab904ecae (patch) | |
tree | 76245c69b26accaa49216a8b7e343888d48b6d05 | |
parent | b1228b7dcf5257534109fdaefb40c67645bc2a4a (diff) | |
download | samba-bfbca5ac7706d03056366b84b679faeab904ecae.tar.gz samba-bfbca5ac7706d03056366b84b679faeab904ecae.tar.bz2 samba-bfbca5ac7706d03056366b84b679faeab904ecae.zip |
changes from Luke
(This used to be commit 5269aa277c635cfda65a27fd1b2e587ac181e1c3)
-rw-r--r-- | source3/include/nameserv.h | 39 | ||||
-rw-r--r-- | source3/nameelect.c | 25 | ||||
-rw-r--r-- | source3/namework.c | 3 | ||||
-rw-r--r-- | source3/nmbd/nmbd.c | 27 |
4 files changed, 69 insertions, 25 deletions
diff --git a/source3/include/nameserv.h b/source3/include/nameserv.h index 32ee625fa4..25934c23f7 100644 --- a/source3/include/nameserv.h +++ b/source3/include/nameserv.h @@ -56,6 +56,9 @@ #define NAME_MFLAG(p) (((p) & NB_FLGMSK) == NB_MFLAG) #define NAME__FLAG(p) (((p) & NB_FLGMSK) == NB__FLAG) +#define MSBROWSE "\001\002__MSBROWSE__\002" + +enum name_search { FIND_SELF, FIND_GLOBAL }; enum name_source {STATUS_QUERY, LMHOSTS, REGISTER, SELF, DNS, DNSFAIL}; enum node_type {B_NODE=0, P_NODE=1, M_NODE=2, NBDD_NODE=3}; enum packet_type {NMB_PACKET, DGRAM_PACKET}; @@ -260,14 +263,32 @@ struct packet_struct #define AM_DOMCTL(work) (work->ServerType & SV_TYPE_DOMAIN_CTRL) -#define ANN_HostAnnouncement 1 -#define ANN_AnnouncementRequest 2 -#define ANN_Election 8 -#define ANN_GetBackupListReq 9 -#define ANN_GetBackupListResp 10 -#define ANN_BecomeBackup 11 -#define ANN_DomainAnnouncement 12 -#define ANN_MasterAnnouncement 13 -#define ANN_ResetBrowserState 14 +/* ids for netbios packet types */ +#define ANN_HostAnnouncement 1 +#define ANN_AnnouncementRequest 2 +#define ANN_Election 8 +#define ANN_GetBackupListReq 9 +#define ANN_GetBackupListResp 10 +#define ANN_BecomeBackup 11 +#define ANN_DomainAnnouncement 12 +#define ANN_MasterAnnouncement 13 +#define ANN_ResetBrowserState 14 #define ANN_LocalMasterAnnouncement 15 + +/* broadcast packet announcement intervals, in minutes */ + +/* search for master browsers of workgroups samba knows about, + except default */ +#define CHECK_TIME_MST_BROWSE 5 + +/* request backup browser announcements from other servers */ +#define CHECK_TIME_ANNOUNCE_BACKUP 15 + +/* request host announcements from other servers: min and max of interval */ +#define CHECK_TIME_MIN_HOST_ANNCE 3 +#define CHECK_TIME_MAX_HOST_ANNCE 12 + +/* announce as master to WINS server and any Primary Domain Controllers */ +#define CHECK_TIME_MST_ANNOUNCE 15 + diff --git a/source3/nameelect.c b/source3/nameelect.c index 765791b80f..2672bb2ed6 100644 --- a/source3/nameelect.c +++ b/source3/nameelect.c @@ -45,7 +45,6 @@ extern time_t StartupTime; #define AM_MASTER(work) (work->ServerType & SV_TYPE_MASTER_BROWSER) -#define MSBROWSE "\001\002__MSBROWSE__\002" #define BROWSE_MAILSLOT "\\MAILSLOT\\BROWSE" extern struct domain_record *domainlist; @@ -61,7 +60,9 @@ void check_master_browser(void) struct domain_record *d; if (!lastrun) lastrun = t; - if (t < lastrun + 5*60) return; + if (t < lastrun + CHECK_TIME_MST_BROWSE * 60) + return; + lastrun = t; dump_workgroups(); @@ -108,16 +109,16 @@ void browser_gone(char *work_name, struct in_addr ip) } else { - DEBUG(2,("no master browser for persistent entry %s %s\n", - work->work_group, inet_ntoa(d->bcast_ip))); + /* XXXX note: this will delete entries that have been added in by + lmhosts as well. a flag to ensure that these are not deleted may + be considered */ + + /* workgroup with no master browser is not the default workgroup: + it's also not on our subnet. therefore delete it: it can be + recreated dynamically */ - /* XXXX oh dear. we are going to have problems here. the - entry is a persistent one, there isn't anyone responsible - for this workgroup up and running, yet we can't find it - and we are going to continually have name_queries until - a master browser is found for this workgroup on the - remote subnet. - */ + send_election(d, work->work_group, 0, 0, myname); + remove_workgroup(d, work); } } @@ -177,7 +178,7 @@ static void become_master(struct domain_record *d, struct work_record *work) DEBUG(4,("Domain master: adding names...\n")); /* add domain master and domain member names or register with WINS */ - add_name_entry(work->work_group,0x1b,NB_ACTIVE ); + add_name_entry(work->work_group,0x1b,NB_ACTIVE); work->ServerType |= SV_TYPE_DOMAIN_MASTER; if (lp_domain_logons()) diff --git a/source3/namework.c b/source3/namework.c index 5e61ecefb4..7764653968 100644 --- a/source3/namework.c +++ b/source3/namework.c @@ -71,7 +71,6 @@ extern time_t StartupTime; #define AM_MASTER(work) (work->ServerType & SV_TYPE_MASTER_BROWSER) #define AM_BACKUP(work) (work->ServerType & SV_TYPE_BACKUP_BROWSER) -#define MSBROWSE "\001\002__MSBROWSE__\002" #define BROWSE_MAILSLOT "\\MAILSLOT\\BROWSE" #define GET_TTL(ttl) ((ttl)?MIN(ttl,lp_max_ttl()):lp_max_ttl()) @@ -652,7 +651,7 @@ static void process_send_backup_list(struct packet_struct *p,char *buf) { struct dgram_packet *dgram = &p->packet.dgram; struct in_addr ip = dgram->header.source_ip; - struct domain_record *d; /* = find_domain(ip); */ + struct domain_record *d; struct work_record *work; int count = CVAL(buf,0); diff --git a/source3/nmbd/nmbd.c b/source3/nmbd/nmbd.c index cd2ebb0521..8ab9f528ef 100644 --- a/source3/nmbd/nmbd.c +++ b/source3/nmbd/nmbd.c @@ -55,6 +55,28 @@ time_t StartupTime =0; extern struct in_addr ipzero; + /**************************************************************************** +catch a sigterm +****************************************************************************/ +static int sig_term() +{ + BlockSignals(True); + + DEBUG(0,("Got SIGTERM: going down...\n")); + + dump_names(); + reload_services(True); + + /* remove all samba names, with wins server if necessary. */ + remove_my_names(); + + /* XXXX don't care if we never receive a response back... yet */ + /* XXXX other things: if we are a master browser, force an election? */ + + exit(0); +} + + /**************************************************************************** catch a sighup ****************************************************************************/ @@ -267,7 +289,7 @@ static void load_hosts_file(char *fname) if (group) { add_domain_entry(ipaddr, ipmask, name, True); } else { - add_netbios_entry(name,0x20,NB_ACTIVE,0,source,ipaddr,False); + add_netbios_entry(name,0x20,NB_ACTIVE,0,source,ipaddr); } } } @@ -426,8 +448,9 @@ static void usage(char *pname) fault_setup(fault_continue); signal(SIGHUP,SIGNAL_CAST sig_hup); + signal(SIGTERM,SIGNAL_CAST sig_term); - while ((opt = getopt (argc, argv, "s:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:")) != EOF) + while ((opt = getopt(argc, argv, "s:T:I:C:bAi:B:N:Rn:l:d:Dp:hSH:G:")) != EOF) { switch (opt) { |