summaryrefslogtreecommitdiffstats
path: root/source/nmbd
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-06-26 06:44:37 +0000
committerAndrew Tridgell <tridge@samba.org>2002-06-26 06:44:37 +0000
commita049360d5b0d95a935b06aad43efc17d34de46dc (patch)
treed88aba5d455180988a3ff3ae01a15b6b91f96a2f /source/nmbd
parent4a7813711130625598e0ffe92e7938890b818d2f (diff)
downloadsamba-a049360d5b0d95a935b06aad43efc17d34de46dc.tar.gz
samba-a049360d5b0d95a935b06aad43efc17d34de46dc.tar.xz
samba-a049360d5b0d95a935b06aad43efc17d34de46dc.zip
- completely rewrote the wins_srv.c code. It is now much simpler, and
gives us a good grounding to properly support multiple wins servers for different interfaces (which will be coming soon ...) - fixed our wins registration failover code to actually do failover! We were not trying to register with a secondary wins server at all when the primary was down. We now fallback correctly. - fixed the multi-homed name registration packets so that they work even in a non-connected network (ie. when one of our interfaces is not routable from the wins server. Yes, this really happens in the real world).
Diffstat (limited to 'source/nmbd')
-rw-r--r--source/nmbd/nmbd_nameregister.c9
-rw-r--r--source/nmbd/nmbd_namerelease.c11
-rw-r--r--source/nmbd/nmbd_packets.c16
3 files changed, 29 insertions, 7 deletions
diff --git a/source/nmbd/nmbd_nameregister.c b/source/nmbd/nmbd_nameregister.c
index cbc72fe2a97..cc1fac55772 100644
--- a/source/nmbd/nmbd_nameregister.c
+++ b/source/nmbd/nmbd_nameregister.c
@@ -197,6 +197,15 @@ static void register_name_timeout_response(struct subnet_record *subrec,
DEBUG(2,("register_name_timeout_response: WINS server at address %s is not \
responding.\n", inet_ntoa(rrec->packet->ip)));
+ /* mark it temporarily dead */
+ wins_srv_died(rrec->packet->ip);
+
+ /* and try the next wins server in our failover list */
+ rrec->packet->ip = wins_srv_ip();
+
+ /* also update the UNICODE subnet IPs */
+ subrec->bcast_ip = subrec->mask_ip = subrec->myip = rrec->packet->ip;
+
/* Keep trying to contact the WINS server periodically. This allows
us to work correctly if the WINS server is down temporarily when
we come up. */
diff --git a/source/nmbd/nmbd_namerelease.c b/source/nmbd/nmbd_namerelease.c
index fd35181f33f..cefab44a084 100644
--- a/source/nmbd/nmbd_namerelease.c
+++ b/source/nmbd/nmbd_namerelease.c
@@ -147,9 +147,14 @@ static void release_name_timeout_response(struct subnet_record *subrec,
DEBUG(2,("release_name_timeout_response: WINS server at address %s is not \
responding.\n", inet_ntoa(rrec->packet->ip)));
- /* Keep trying to contact the WINS server periodically. This allows
- us to work correctly if the WINS server is down temporarily when
- we want to delete the name. */
+ /* mark it temporarily dead */
+ wins_srv_died(rrec->packet->ip);
+
+ /* and try the next wins server */
+ rrec->packet->ip = wins_srv_ip();
+
+ /* also update the UNICODE subnet IPs */
+ subrec->bcast_ip = subrec->mask_ip = subrec->myip = rrec->packet->ip;
/* Reset the number of attempts to zero and double the interval between
retries. Max out at 5 minutes. */
diff --git a/source/nmbd/nmbd_packets.c b/source/nmbd/nmbd_packets.c
index a11b30b1dc2..b5741caae09 100644
--- a/source/nmbd/nmbd_packets.c
+++ b/source/nmbd/nmbd_packets.c
@@ -264,11 +264,19 @@ static BOOL create_and_init_additional_record(struct packet_struct *packet,
/* Set the address for the name we are registering. */
putip(&nmb->additional->rdata[2], register_ip);
- /* Ensure that we send out the file descriptor to give us the
- the specific source address we are registering as our
- IP source address. */
-
+#if 0
+ /* I removed this forced source IP as it breaks wins failover. The
+ problem is that our 2nd interface IP may not be routable to the
+ wins server, in which case all these nice packets we are senidng
+ out will never get a response and we end up marking a perfectly good wins server dead.
+
+ In general I can't see any reason why we should force the source
+ ip on a packet anyway. We should just let the kernels routin
+ table take care of it, as that is the only place which really
+ knows what is routable and what isn't. (tridge)
+ */
packet->fd = find_subnet_fd_for_address( *register_ip );
+#endif
return True;
}