[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-28a-30-g4b11de3

Jeremy Allison jra at samba.org
Thu Apr 10 15:56:53 GMT 2008


The branch, v3-0-test has been updated
       via  4b11de3cfaa6a193f919f8b68c8ca0a7bca46ab9 (commit)
      from  26ebd1ffde1715640d50ad1cafc2f778b9fbbb47 (commit)

http://gitweb.samba.org/?p=samba.git;a=shortlog;h=v3-0-test


- Log -----------------------------------------------------------------
commit 4b11de3cfaa6a193f919f8b68c8ca0a7bca46ab9
Author: Jeremy Allison <jra at samba.org>
Date:   Thu Apr 10 08:56:30 2008 -0700

    Fix the last reported debian problem with nmbd not waiting
    until interfaces come up.
    Jeremy.

-----------------------------------------------------------------------

Summary of changes:
 source/nmbd/nmbd_subnetdb.c |   32 ++++++++++++++++++++++----------
 1 files changed, 22 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/nmbd/nmbd_subnetdb.c b/source/nmbd/nmbd_subnetdb.c
index 398119c..61db70f 100644
--- a/source/nmbd/nmbd_subnetdb.c
+++ b/source/nmbd/nmbd_subnetdb.c
@@ -180,15 +180,19 @@ struct subnet_record *make_normal_subnet(struct interface *iface)
 
 BOOL create_subnets(void)
 {    
-	int num_interfaces = iface_count();
+	int num_interfaces;
 	int i;
 	struct in_addr unicast_ip, ipzero;
 
-	if(num_interfaces == 0) {
-		void (*saved_handler)(int);
+  try_interfaces_again:
 
+	if (iface_count() == 0) {
 		DEBUG(0,("create_subnets: No local interfaces !\n"));
 		DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
+	}
+
+	while (iface_count() == 0) {
+		void (*saved_handler)(int);
 
 		/* 
 		 * Whilst we're waiting for an interface, allow SIGTERM to
@@ -197,10 +201,8 @@ BOOL create_subnets(void)
 
 		saved_handler = CatchSignal( SIGTERM, SIGNAL_CAST SIG_DFL );
 
-		while (iface_count() == 0) {
-			sleep(5);
-			load_interfaces();
-		}
+		sleep(5);
+		load_interfaces();
 
 		/* 
 		 * We got an interface, restore our normal term handler.
@@ -241,9 +243,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()) {


-- 
Samba Shared Repository


More information about the samba-cvs mailing list