summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_subnetdb.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_subnetdb.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_subnetdb.c')
-rw-r--r--source3/nmbd/nmbd_subnetdb.c58
1 files changed, 12 insertions, 46 deletions
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index 146b6cbdfe..e68fc1589c 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -267,45 +267,14 @@ BOOL create_subnets(void)
if (!make_normal_subnet(iface)) return False;
}
- /*
- * If we have been configured to use a WINS server, then try and
- * get the ip address of it here. If we are the WINS server then
- * set the unicast subnet address to be the first of our own real
- * addresses.
- *
- * NOTE: I'm not sure of the implications of WINS server failover
- * on this bit of code. Because of failover, the WINS
- * server address can change. crh
- */
-
- if( wins_srv_count() )
- {
- struct in_addr real_wins_ip;
- real_wins_ip = wins_srv_ip();
-
- if (!is_zero_ip(real_wins_ip))
- {
- unicast_ip = real_wins_ip;
- }
- else
- {
- /* wins_srv_ip() can return a zero IP if all servers are
- * either down or incorrectly entered in smb.conf. crh
- */
- DEBUG(0,("No 'live' WINS servers found. Check 'wins server' parameter.\n"));
- return False;
- }
- }
- else if(lp_we_are_a_wins_server())
- {
- /* Pick the first interface ip address as the WINS server ip. */
- unicast_ip = *iface_n_ip(0);
- }
- else
- {
- /* We should not be using a WINS server at all. Set the
- ip address of the subnet to be zero. */
- zero_ip(&unicast_ip);
+ if (lp_we_are_a_wins_server()) {
+ /* Pick the first interface ip address as the WINS server ip. */
+ unicast_ip = *iface_n_ip(0);
+ } else {
+ /* note that we do not set the wins server IP here. We just
+ set it at zero and let the wins registration code cope
+ with getting the IPs right for each packet */
+ zero_ip(&unicast_ip);
}
/*
@@ -346,16 +315,13 @@ BOOL create_subnets(void)
/*******************************************************************
Function to tell us if we can use the unicast subnet.
******************************************************************/
-
BOOL we_are_a_wins_client(void)
{
- static int cache_we_are_a_wins_client = -1;
-
- if(cache_we_are_a_wins_client == -1)
- cache_we_are_a_wins_client = (is_zero_ip(unicast_subnet->myip) ?
- False : True);
+ if (wins_srv_count() > 0) {
+ return True;
+ }
- return cache_we_are_a_wins_client;
+ return False;
}
/*******************************************************************