Blob Blame History Raw
From 13f4a00d4d490fb65f93c246d1c93ed56a47213f Mon Sep 17 00:00:00 2001
From: Dan Williams <dcbw@redhat.com>
Date: Thu, 23 Jan 2014 13:02:16 -0600
Subject: [PATCH] core: only log about IPv6 Commit the first time
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

Since IPv6 configuration gets updated every time a router advertisement
comes in, it can lead NM to continuously logging:

NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) scheduled...
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) started...
NetworkManager: <info> Activation (eth0) Stage 5 of 5 (IPv6 Commit) complete.

that's annoying.  So after the initial configuration is done, make
subsequent IPv6 Commit log messages debug instead of info.

Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
 src/devices/nm-device.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index 035434e..4684efe 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -335,8 +335,6 @@ static gboolean nm_device_set_ip6_config (NMDevice *dev,
                                           gboolean commit,
                                           NMDeviceStateReason *reason);
 
-static gboolean nm_device_activate_ip6_config_commit (gpointer user_data);
-
 static gboolean check_connection_available (NMDevice *device, NMConnection *connection);
 
 static gboolean spec_match_list (NMDevice *device, const GSList *specs);
@@ -4232,6 +4230,7 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
 {
 	NMDevice *self = NM_DEVICE (user_data);
 	NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+	guint level = (priv->ip6_state == IP_DONE) ? LOGL_DEBUG : LOGL_INFO;
 	NMActRequest *req;
 	const char *iface;
 	NMConnection *connection;
@@ -4241,8 +4240,7 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
 	activation_source_clear (self, FALSE, AF_INET6);
 
 	iface = nm_device_get_iface (self);
-	nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 5 of 5 (IPv6 Commit) started...",
-	             iface);
+	nm_log (LOGD_DEVICE, level, "Activation (%s) Stage 5 of 5 (IPv6 Commit) started...", iface);
 
 	req = nm_device_get_act_request (self);
 	g_assert (req);
@@ -4262,14 +4260,13 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
 		if (nm_device_get_state (self) == NM_DEVICE_STATE_IP_CONFIG)
 			nm_device_state_changed (self, NM_DEVICE_STATE_IP_CHECK, NM_DEVICE_STATE_REASON_NONE);
 	} else {
-		nm_log_info (LOGD_DEVICE | LOGD_IP6,
+		nm_log_warn (LOGD_DEVICE | LOGD_IP6,
 			         "Activation (%s) Stage 5 of 5 (IPv6 Commit) failed",
 					 iface);
 		nm_device_state_changed (self, NM_DEVICE_STATE_FAILED, reason);
 	}
 
-	nm_log_info (LOGD_DEVICE, "Activation (%s) Stage 5 of 5 (IPv6 Commit) complete.",
-	             iface);
+	nm_log (LOGD_DEVICE, level, "Activation (%s) Stage 5 of 5 (IPv6 Commit) complete.", iface);
 
 	return FALSE;
 }
@@ -4277,13 +4274,16 @@ nm_device_activate_ip6_config_commit (gpointer user_data)
 void
 nm_device_activate_schedule_ip6_config_result (NMDevice *self)
 {
+	NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
+	guint level = (priv->ip6_state == IP_DONE) ? LOGL_DEBUG : LOGL_INFO;
+
 	g_return_if_fail (NM_IS_DEVICE (self));
 
 	activation_source_schedule (self, nm_device_activate_ip6_config_commit, AF_INET6);
 
-	nm_log_info (LOGD_DEVICE | LOGD_IP6,
-		         "Activation (%s) Stage 5 of 5 (IPv6 Commit) scheduled...",
-		         nm_device_get_iface (self));
+	nm_log (LOGD_DEVICE | LOGD_IP6, level,
+		    "Activation (%s) Stage 5 of 5 (IPv6 Commit) scheduled...",
+		    nm_device_get_iface (self));
 }
 
 gboolean
-- 
1.7.11.7