summaryrefslogtreecommitdiff
path: root/source3/nmbd/nmbd_subnetdb.c
diff options
context:
space:
mode:
authorAndrew Tridgell <tridge@samba.org>2002-07-15 10:35:28 +0000
committerAndrew Tridgell <tridge@samba.org>2002-07-15 10:35:28 +0000
commite90b65284812aaa5ff9e9935ce9bbad7791cbbcd (patch)
tree9e744d1dc2f93934a4b49166a37383d3cb2b2139 /source3/nmbd/nmbd_subnetdb.c
parentec167dc9cc0ec2ee461837c25a371d2981744208 (diff)
downloadsamba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.gz
samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.tar.bz2
samba-e90b65284812aaa5ff9e9935ce9bbad7791cbbcd.zip
updated the 3.0 branch from the head branch - ready for alpha18
(This used to be commit 03ac082dcb375b6f3ca3d810a6a6367542bc23ce)
Diffstat (limited to 'source3/nmbd/nmbd_subnetdb.c')
-rw-r--r--source3/nmbd/nmbd_subnetdb.c71
1 files changed, 21 insertions, 50 deletions
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index 6c6e7adbb8..e68fc1589c 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -233,12 +233,17 @@ BOOL create_subnets(void)
struct in_addr unicast_ip, ipzero;
extern struct in_addr loopback_ip;
- if(num_interfaces == 0)
- {
- DEBUG(0,("create_subnets: No local interfaces !\n"));
- return False;
+ if(num_interfaces == 0) {
+ DEBUG(0,("create_subnets: No local interfaces !\n"));
+ DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
+ while (iface_count() == 0) {
+ sleep(5);
+ load_interfaces();
+ }
}
+ num_interfaces = iface_count();
+
/*
* Create subnets from all the local interfaces and thread them onto
* the linked list.
@@ -262,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);
}
/*
@@ -341,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;
}
/*******************************************************************