summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_mynames.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-06-27 14:37:17 +0000
committerAndrew Tridgell <tridge@samba.org>2002-06-27 14:37:17 +0000
commit223ddc3f2daf25b16ce60230336747d5fab61e39 (patch)
tree66fc3123346244d5cc7b0dd47274b214fa1d104d /source3/nmbd/nmbd_mynames.c
parent675a108c65834f9402d967926b30e50e811843c1 (diff)
downloadsamba-223ddc3f2daf25b16ce60230336747d5fab61e39.tar.gz
samba-223ddc3f2daf25b16ce60230336747d5fab61e39.tar.bz2
samba-223ddc3f2daf25b16ce60230336747d5fab61e39.zip
The next phase in the WINS rewrite!
We now cope wiith multiple WINS groups and multiple failover servers for release and refresh as well as registration. We also do the regitrations in the same fashion as W2K does, where we don't try to register the next IP in the list for a name until the WINS server has acked the previos IP. This prevents us flooding the WINS server and also seems to make for much more reliable multi-homed registration. I also changed the dead WINS server code to mark pairs of IPs dead, not individual IPs. The idea is that a WINS server might be dead from the point of view of one of our interfaces, but not another, so we need to keep talking to it on one while moving onto a failover WINS server on the other interface. This copes much better with partial LAN outages and weird routing tables. (This used to be commit 313f2c9ff7a513802e4f893324865e70912d419e)
Diffstat (limited to 'source3/nmbd/nmbd_mynames.c')
-rw-r--r--source3/nmbd/nmbd_mynames.c93
1 files changed, 37 insertions, 56 deletions
diff --git a/source3/nmbd/nmbd_mynames.c b/source3/nmbd/nmbd_mynames.c
index aac188db2b..345245c57d 100644
--- a/source3/nmbd/nmbd_mynames.c
+++ b/source3/nmbd/nmbd_mynames.c
@@ -184,67 +184,48 @@ BOOL register_my_workgroup_and_names(void)
/****************************************************************************
Remove all the names we registered.
**************************************************************************/
-
-void release_my_names(void)
+void release_wins_names(void)
{
-#if 0 /*JRR: do WINS server only, otherwise clients ignore us when we come back up*/
- struct subnet_record *subrec;
-
- for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec))
-#else
- struct subnet_record *subrec = unicast_subnet;
-#endif
- {
- struct name_record *namerec, *nextnamerec;
-
- for (namerec = (struct name_record *)ubi_trFirst( subrec->namelist );
- namerec;
- namerec = nextnamerec)
- {
- nextnamerec = (struct name_record *)ubi_trNext( namerec );
- if( (namerec->data.source == SELF_NAME)
- && !NAME_IS_DEREGISTERING(namerec) )
- release_name( subrec, namerec, standard_success_release,
- NULL, NULL);
- }
- }
+ struct subnet_record *subrec = unicast_subnet;
+ struct name_record *namerec, *nextnamerec;
+
+ for (namerec = (struct name_record *)ubi_trFirst( subrec->namelist );
+ namerec;
+ namerec = nextnamerec) {
+ nextnamerec = (struct name_record *)ubi_trNext( namerec );
+ if( (namerec->data.source == SELF_NAME)
+ && !NAME_IS_DEREGISTERING(namerec) )
+ release_name( subrec, namerec, standard_success_release,
+ NULL, NULL);
+ }
}
/*******************************************************************
- Refresh our registered names.
+ Refresh our registered names with WINS
******************************************************************/
-
void refresh_my_names(time_t t)
{
- struct subnet_record *subrec;
-
- for (subrec = FIRST_SUBNET; subrec; subrec = NEXT_SUBNET_INCLUDING_UNICAST(subrec))
- {
- struct name_record *namerec;
-
- /* B nodes don't send out name refresh requests, see RFC 1001, 15.5.1 */
- if (subrec != unicast_subnet)
- continue;
-
- for( namerec = (struct name_record *)ubi_trFirst( subrec->namelist );
- namerec;
- namerec = (struct name_record *)ubi_trNext( namerec ) )
- {
- /* Each SELF name has an individual time to be refreshed. */
- if( (namerec->data.source == SELF_NAME)
- && (namerec->data.refresh_time < t)
- && ( namerec->data.death_time != PERMANENT_TTL) )
- {
- /* We cheat here and pretend the refresh is going to be
- successful & update the refresh times. This stops
- multiple refresh calls being done. We actually
- deal with refresh failure in the fail_fn.
- */
- if( !is_refresh_already_queued( subrec, namerec) )
- refresh_name( subrec, namerec, NULL, NULL, NULL );
- namerec->data.death_time = t + lp_max_ttl();
- namerec->data.refresh_time = t + MIN(lp_max_ttl(), MAX_REFRESH_TIME);
- }
- }
- }
+ struct name_record *namerec;
+
+ if (wins_srv_count() < 1) return;
+
+ for (namerec = (struct name_record *)ubi_trFirst(unicast_subnet->namelist);
+ namerec;
+ namerec = (struct name_record *)ubi_trNext(namerec)) {
+ /* Each SELF name has an individual time to be refreshed. */
+ if ((namerec->data.source == SELF_NAME) &&
+ (namerec->data.refresh_time < t) &&
+ (namerec->data.death_time != PERMANENT_TTL)) {
+ /* We cheat here and pretend the refresh is going to be
+ successful & update the refresh times. This stops
+ multiple refresh calls being done. We actually
+ deal with refresh failure in the fail_fn.
+ */
+ if (!is_refresh_already_queued(unicast_subnet, namerec)) {
+ wins_refresh_name(namerec);
+ }
+ namerec->data.death_time = t + lp_max_ttl();
+ namerec->data.refresh_time = t + MIN(lp_max_ttl(), MAX_REFRESH_TIME);
+ }
+ }
}