summaryrefslogtreecommitdiff
path: root/source3/nmbd
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2008-04-10 08:56:34 -0700
committerJeremy Allison <jra@samba.org>2008-04-10 08:56:34 -0700
commit948ebaf0330368ce8fb12ae65f8fcf550a6aab2a (patch)
tree865cd6c8bb8b8ec488916a65f1e972387702badd /source3/nmbd
parentb884db5c47a958188d9570f78093b9443b48b9cc (diff)
downloadsamba-948ebaf0330368ce8fb12ae65f8fcf550a6aab2a.tar.gz
samba-948ebaf0330368ce8fb12ae65f8fcf550a6aab2a.tar.bz2
samba-948ebaf0330368ce8fb12ae65f8fcf550a6aab2a.zip
Fix the last reported debian problem with nmbd not waiting
until interfaces come up. Jeremy. (This used to be commit 59a2f0873c789822d46f862042921a8ba8f2bd28)
Diffstat (limited to 'source3/nmbd')
-rw-r--r--source3/nmbd/nmbd_subnetdb.c32
1 files changed, 22 insertions, 10 deletions
diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index d100ad482a..a4422d27d5 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -199,11 +199,16 @@ bool create_subnets(void)
int i;
struct in_addr unicast_ip, ipzero;
- if(num_interfaces == 0) {
- void (*saved_handler)(int);
+ try_interfaces_again:
+ if (iface_count_v4() == 0) {
DEBUG(0,("create_subnets: No local interfaces !\n"));
DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
+ }
+
+ /* We only count IPv4 interfaces here. */
+ while (iface_count_v4() == 0) {
+ void (*saved_handler)(int);
/*
* Whilst we're waiting for an interface, allow SIGTERM to
@@ -212,11 +217,8 @@ bool create_subnets(void)
saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
- /* We only count IPv4 interfaces here. */
- while (iface_count_v4() == 0) {
- sleep(5);
- load_interfaces();
- }
+ sleep(5);
+ load_interfaces();
/*
* We got an interface, restore our normal term handler.
@@ -268,9 +270,19 @@ bool create_subnets(void)
/* We must have at least one subnet. */
if (subnetlist == NULL) {
- DEBUG(0,("create_subnets: unable to create any subnet from "
- "given interfaces. nmbd is terminating\n"));
- return False;
+ void (*saved_handler)(int);
+
+ DEBUG(0,("create_subnets: Unable to create any subnet from "
+ "given interfaces. Is your interface line in "
+ "smb.conf correct ?\n"));
+
+ saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
+
+ sleep(5);
+ load_interfaces();
+
+ CatchSignal( SIGTERM, SIGNAL_CAST saved_handler );
+ goto try_interfaces_again;
}
if (lp_we_are_a_wins_server()) {