[SCM] Samba Shared Repository - branch v3-3-test updated - release-3-2-0pre2-3739-gcbc6b89

Jeremy Allison jra at samba.org
Wed Aug 20 00:32:46 GMT 2008


The branch, v3-3-test has been updated
       via  cbc6b89feee81710f77c87bb7ce429fb4156ce07 (commit)
      from  54746593b9b01f0ecffd43fa48531d3bb9f614ef (commit)

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


- Log -----------------------------------------------------------------
commit cbc6b89feee81710f77c87bb7ce429fb4156ce07
Author: Jeremy Allison <jra at samba.org>
Date:   Tue Aug 19 17:32:07 2008 -0700

    Fix bug 5697 nmbd spins in reload_interfaces when only loopback has an IPv4 address
    reported by Ted Percival <ted at midg3t.net>.
    Jeremy.

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

Summary of changes:
 source/include/proto.h      |    2 +-
 source/lib/interface.c      |    7 +++++--
 source/nmbd/nmbd.c          |    4 ++--
 source/nmbd/nmbd_subnetdb.c |   11 ++++++-----
 4 files changed, 14 insertions(+), 10 deletions(-)


Changeset truncated at 500 lines:

diff --git a/source/include/proto.h b/source/include/proto.h
index a1595dd..65bfe39 100644
--- a/source/include/proto.h
+++ b/source/include/proto.h
@@ -648,7 +648,7 @@ bool is_local_net(const struct sockaddr_storage *from);
 void setup_linklocal_scope_id(struct sockaddr_storage *pss);
 bool is_local_net_v4(struct in_addr from);
 int iface_count(void);
-int iface_count_v4(void);
+int iface_count_v4_nl(void);
 const struct in_addr *first_ipv4_iface(void);
 struct interface *get_interface(int n);
 const struct sockaddr_storage *iface_n_sockaddr_storage(int n);
diff --git a/source/lib/interface.c b/source/lib/interface.c
index eb0af9e..2e7c270 100644
--- a/source/lib/interface.c
+++ b/source/lib/interface.c
@@ -131,15 +131,18 @@ int iface_count(void)
 }
 
 /****************************************************************************
- How many interfaces do we have (v4 only) ?
+ How many non-loopback IPv4 interfaces do we have ?
 **************************************************************************/
 
-int iface_count_v4(void)
+int iface_count_v4_nl(void)
 {
 	int ret = 0;
 	struct interface *i;
 
 	for (i=local_interfaces;i;i=i->next) {
+		if (is_loopback_addr(&i->ip)) {
+			continue;
+		}
 		if (i->ip.ss_family == AF_INET) {
 			ret++;
 		}
diff --git a/source/nmbd/nmbd.c b/source/nmbd/nmbd.c
index 83005f0..d9f2af4 100644
--- a/source/nmbd/nmbd.c
+++ b/source/nmbd/nmbd.c
@@ -296,8 +296,8 @@ static void reload_interfaces(time_t t)
 
 		BlockSignals(false, SIGTERM);
 
-		/* We only count IPv4 interfaces here. */
-		while (iface_count_v4() == 0 && !got_sig_term) {
+		/* We only count IPv4, non-loopback interfaces here. */
+		while (iface_count_v4_nl() == 0 && !got_sig_term) {
 			sleep(5);
 			load_interfaces();
 		}
diff --git a/source/nmbd/nmbd_subnetdb.c b/source/nmbd/nmbd_subnetdb.c
index a4422d2..225def5 100644
--- a/source/nmbd/nmbd_subnetdb.c
+++ b/source/nmbd/nmbd_subnetdb.c
@@ -195,19 +195,20 @@ struct subnet_record *make_normal_subnet(const struct interface *iface)
 bool create_subnets(void)
 {
 	/* We only count IPv4 interfaces whilst we're waiting. */
-	int num_interfaces = iface_count_v4();
+	int num_interfaces;
 	int i;
 	struct in_addr unicast_ip, ipzero;
 
   try_interfaces_again:
 
-	if (iface_count_v4() == 0) {
-		DEBUG(0,("create_subnets: No local interfaces !\n"));
+	/* Only count IPv4, non-loopback interfaces. */
+	if (iface_count_v4_nl() == 0) {
+		DEBUG(0,("create_subnets: No local IPv4 non-loopback interfaces !\n"));
 		DEBUG(0,("create_subnets: Waiting for an interface to appear ...\n"));
 	}
 
-	/* We only count IPv4 interfaces here. */
-	while (iface_count_v4() == 0) {
+	/* We only count IPv4, non-loopback interfaces here. */
+	while (iface_count_v4_nl() == 0) {
 		void (*saved_handler)(int);
 
 		/*


-- 
Samba Shared Repository


More information about the samba-cvs mailing list