summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>1998-08-31 04:19:31 +0000
committerAndrew Tridgell <tridge@samba.org>1998-08-31 04:19:31 +0000
commit1d23dd0912e81ff72695bd043e8e2aee32da18a8 (patch)
tree58a6def46c4596b266f23353e443105b4bf28f05 /source
parent55333edd2eed33961ced4eb4b6898f5ca9ca1820 (diff)
downloadsamba-1d23dd0912e81ff72695bd043e8e2aee32da18a8.tar.gz
set a maximum name refresh time of 20 minutes.
The previous code was strictly correct, but not very practical. self names were only refreshed every 3 days. I hit a situation where the Samba WINS server was restarted after deleting wins.dat and didn't notice some remote subnets (also running Samba). I realised that the complete database wouldn't have been rebuilt for 3 days, which is way too long. In order to recover from WINS restarts we need a much shorter maximum refresh time.
Diffstat (limited to 'source')
-rw-r--r--source/include/nameserv.h4
-rw-r--r--source/nmbd/nmbd_mynames.c2
-rw-r--r--source/nmbd/nmbd_namelistdb.c4
3 files changed, 7 insertions, 3 deletions
diff --git a/source/include/nameserv.h b/source/include/nameserv.h
index fe00a1415d5..c219a1f723b 100644
--- a/source/include/nameserv.h
+++ b/source/include/nameserv.h
@@ -546,6 +546,10 @@ struct packet_struct
/* Do all remote announcements this often. */
#define REMOTE_ANNOUNCE_INTERVAL 180
+/* what is the maximum period between name refreshes. Note that this only
+ affects non-permanent self names */
+#define MAX_REFRESH_TIME (60*20)
+
/* Types of machine we can announce as. */
#define ANNOUNCE_AS_NT 1
#define ANNOUNCE_AS_WIN95 2
diff --git a/source/nmbd/nmbd_mynames.c b/source/nmbd/nmbd_mynames.c
index ba422741652..4a4e102786e 100644
--- a/source/nmbd/nmbd_mynames.c
+++ b/source/nmbd/nmbd_mynames.c
@@ -197,7 +197,7 @@ void refresh_my_names(time_t t)
if( !is_refresh_already_queued( subrec, namerec) )
refresh_name( subrec, namerec, NULL, NULL, NULL );
namerec->data.death_time += lp_max_ttl();
- namerec->data.refresh_time += lp_max_ttl();
+ namerec->data.refresh_time += MIN(lp_max_ttl(), MAX_REFRESH_TIME);
}
}
}
diff --git a/source/nmbd/nmbd_namelistdb.c b/source/nmbd/nmbd_namelistdb.c
index de5835a1151..498cbcfdcf6 100644
--- a/source/nmbd/nmbd_namelistdb.c
+++ b/source/nmbd/nmbd_namelistdb.c
@@ -186,7 +186,7 @@ void update_name_ttl( struct name_record *namerec, int ttl )
if( namerec->data.death_time != PERMANENT_TTL )
namerec->data.death_time = time_now + ttl;
- namerec->data.refresh_time = time_now + (ttl/2);
+ namerec->data.refresh_time = time_now + MIN((ttl/2), MAX_REFRESH_TIME);
namerec->subnet->namelist_changed = True;
} /* update_name_ttl */
@@ -251,7 +251,7 @@ struct name_record *add_name_to_subnet( struct subnet_record *subrec,
else
namerec->data.death_time = time_now + ttl;
- namerec->data.refresh_time = time_now + (ttl/2);
+ namerec->data.refresh_time = time_now + MIN((ttl/2), MAX_REFRESH_TIME);
/* Now add the record to the name list. */
update_name_in_namelist( subrec, namerec );