Blob Blame History Raw
From f73c906237aa0c9d45900d69d31c9b39261f062a Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Tue, 16 Sep 2014 18:02:30 +0200
Subject: [PATCH 1/2] lib: Add daemon_status() to util library.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10816

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>
(cherry picked from commit 9f5f5fa8ebf845c53b7a92557d7aec56ed820320)
---
 lib/util/become_daemon.c | 11 +++++++++++
 lib/util/samba_util.h    |  6 ++++++
 2 files changed, 17 insertions(+)

diff --git a/lib/util/become_daemon.c b/lib/util/become_daemon.c
index 35c8b32..688bedd 100644
--- a/lib/util/become_daemon.c
+++ b/lib/util/become_daemon.c
@@ -135,3 +135,14 @@ _PUBLIC_ void daemon_ready(const char *daemon)
 #endif
 	DEBUG(0, ("STATUS=daemon '%s' finished starting up and ready to serve connections", daemon));
 }
+
+_PUBLIC_ void daemon_status(const char *name, const char *msg)
+{
+	if (name == NULL) {
+		name = "Samba";
+	}
+#ifdef HAVE_SYSTEMD
+	sd_notifyf(0, "\nSTATUS=%s: %s", name, msg);
+#endif
+	DEBUG(0, ("STATUS=daemon '%s' : %s", name, msg));
+}
diff --git a/lib/util/samba_util.h b/lib/util/samba_util.h
index e3fe6a6..f4216d8 100644
--- a/lib/util/samba_util.h
+++ b/lib/util/samba_util.h
@@ -853,6 +853,12 @@ _PUBLIC_ void exit_daemon(const char *msg, int error);
 **/
 _PUBLIC_ void daemon_ready(const char *daemon);
 
+/*
+ * Report the daemon status. For example if it is not ready to serve connections
+ * and is waiting for some event to happen.
+ */
+_PUBLIC_ void daemon_status(const char *name, const char *msg);
+
 /**
  * @brief Get a password from the console.
  *
-- 
2.1.0


From 7fcd74039961fa0fb02934bc87ce41fd98234f1a Mon Sep 17 00:00:00 2001
From: Andreas Schneider <asn@samba.org>
Date: Tue, 16 Sep 2014 18:03:51 +0200
Subject: [PATCH 2/2] nmbd: Send waiting status to systemd.

This tells the Administrator what's going on and we should log that IPv6
is not supported.

BUG: https://bugzilla.samba.org/show_bug.cgi?id=10816

Signed-off-by: Andreas Schneider <asn@samba.org>
Reviewed-by: Alexander Bokovoy <ab@samba.org>

Autobuild-User(master): Andreas Schneider <asn@cryptomilk.org>
Autobuild-Date(master): Wed Sep 17 13:16:43 CEST 2014 on sn-devel-104

(cherry picked from commit 2df601bff0d949e66c79366b8248b9d950c0b430)
---
 source3/nmbd/nmbd_subnetdb.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/source3/nmbd/nmbd_subnetdb.c b/source3/nmbd/nmbd_subnetdb.c
index 311a240..6c483af 100644
--- a/source3/nmbd/nmbd_subnetdb.c
+++ b/source3/nmbd/nmbd_subnetdb.c
@@ -247,8 +247,11 @@ bool create_subnets(void)
 
 	/* 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"));
+		daemon_status("nmbd",
+			      "No local IPv4 non-loopback interfaces "
+			      "available, waiting for interface ...");
+		DEBUG(0,("NOTE: NetBIOS name resolution is not supported for "
+			 "Internet Protocol Version 6 (IPv6).\n"));
 	}
 
 	/* We only count IPv4, non-loopback interfaces here. */
-- 
2.1.0