[SCM] Samba Shared Repository - branch v3-0-test updated - release-3-0-31-10-g6acd5c0

Jeremy Allison jra at samba.org
Wed Aug 20 01:14:24 GMT 2008


The branch, v3-0-test has been updated
       via  6acd5c086b0019f54749a67756975b3c0ba35ac0 (commit)
      from  d29db976dcffef772044b1e5246ec6715d6afbbb (commit)

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


- Log -----------------------------------------------------------------
commit 6acd5c086b0019f54749a67756975b3c0ba35ac0
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Aug 19 18:13:25 2008 -0700

    Fix bug 5697 nmbd spins in reload_interfaces when only loopback exists.
    Reported by Ted Percival <ted at midg3t.net>.
    Jeremy.

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

Summary of changes:
 source/lib/interface.c      |   17 +++++++++++++++++
 source/nmbd/nmbd.c          |    2 +-
 source/nmbd/nmbd_subnetdb.c |    6 +++---
 3 files changed, 21 insertions(+), 4 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/lib/interface.c b/source/lib/interface.c
index e2c9294..32a53f2 100644
--- a/source/lib/interface.c
+++ b/source/lib/interface.c
@@ -301,6 +301,23 @@ int iface_count(void)
 }
 
 /****************************************************************************
+  how many non-loopback interfaces do we have
+  **************************************************************************/
+int iface_count_nl(void)
+{
+	int ret = 0;
+	struct interface *i;
+
+	for (i=local_interfaces;i;i=i->next) {
+		if (ip_equal(i->ip, loopback_ip)) {
+			continue;
+		}
+		ret++;
+	}
+	return ret;
+}
+
+/****************************************************************************
   return the Nth interface
   **************************************************************************/
 struct interface *get_interface(int n)
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index df38399..7daf62a 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -248,7 +248,7 @@ static void reload_interfaces(time_t t)
 
 		BlockSignals(false, SIGTERM);
 
-                while (iface_count() == 0 && !got_sig_term) {
+                while (iface_count_nl() == 0 && !got_sig_term) {
 			sleep(5);
 			load_interfaces();
 		}
diff --git a/source/nmbd/nmbd_subnetdb.c b/source/nmbd/nmbd_subnetdb.c
index 61db70f..3732407 100644
--- a/source/nmbd/nmbd_subnetdb.c
+++ b/source/nmbd/nmbd_subnetdb.c
@@ -186,12 +186,12 @@ BOOL create_subnets(void)
 
   try_interfaces_again:
 
-	if (iface_count() == 0) {
-		DEBUG(0,("create_subnets: No local interfaces !\n"));
+	if (iface_count_nl() == 0) {
+		DEBUG(0,("create_subnets: No non-loopback local interfaces !\n"));
 		DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
 	}
 
-	while (iface_count() == 0) {
+	while (iface_count_nl() == 0) {
 		void (*saved_handler)(int);
 
 		/* 


-- 
Samba Shared Repository


More information about the samba-cvs mailing list