NetworkManager/vpn-connection-states.patch
Thomas Haller d4c1522a3e Revert snapshot release 0.9.9.0-29.git20140131, again based on previous 0.9.9.0-28.git20131003
This commit is mostly similar to c9b963bc22 as
we revert to the previous release.
2014-02-16 14:24:24 +01:00

179 lines
5.8 KiB
Diff

From c72d2eb02fa05b29dbff372a3ab02a11f3a0557b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 19 Dec 2013 12:49:31 +0100
Subject: [PATCH 1/2] vpn: print VPN plugin failures and VPN connection reason
changes as strings
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/vpn-manager/nm-vpn-connection.c | 58 ++++++++++++++++++++++++++++++++++---
1 file changed, 54 insertions(+), 4 deletions(-)
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index e7c3e07..d0c82e4 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -438,14 +438,31 @@ nm_vpn_connection_get_service (NMVPNConnection *connection)
return nm_setting_vpn_get_service_type (s_vpn);
}
+static const char *
+vpn_plugin_failure_to_string (NMVPNPluginFailure failure)
+{
+ switch (failure) {
+ case NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED:
+ return "login-failed";
+ case NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED:
+ return "connect-failed";
+ case NM_VPN_PLUGIN_FAILURE_BAD_IP_CONFIG:
+ return "bad-ip-config";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
static void
plugin_failed (DBusGProxy *proxy,
- NMVPNPluginFailure plugin_failure,
- gpointer user_data)
+ NMVPNPluginFailure plugin_failure,
+ gpointer user_data)
{
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (user_data);
- nm_log_warn (LOGD_VPN, "VPN plugin failed: %d", plugin_failure);
+ nm_log_warn (LOGD_VPN, "VPN plugin failed: %s (%d)",
+ vpn_plugin_failure_to_string (plugin_failure), plugin_failure);
switch (plugin_failure) {
case NM_VPN_PLUGIN_FAILURE_LOGIN_FAILED:
@@ -481,6 +498,38 @@ vpn_state_to_string (NMVPNServiceState state)
return "unknown";
}
+static const char *
+vpn_reason_to_string (NMVPNConnectionStateReason reason)
+{
+ switch (reason) {
+ case NM_VPN_CONNECTION_STATE_REASON_NONE:
+ return "none";
+ case NM_VPN_CONNECTION_STATE_REASON_USER_DISCONNECTED:
+ return "user-disconnected";
+ case NM_VPN_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED:
+ return "device-disconnected";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_STOPPED:
+ return "service-stopped";
+ case NM_VPN_CONNECTION_STATE_REASON_IP_CONFIG_INVALID:
+ return "ip-config-invalid";
+ case NM_VPN_CONNECTION_STATE_REASON_CONNECT_TIMEOUT:
+ return "connect-timeout";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_TIMEOUT:
+ return "service-start-timeout";
+ case NM_VPN_CONNECTION_STATE_REASON_SERVICE_START_FAILED:
+ return "service-start-failed";
+ case NM_VPN_CONNECTION_STATE_REASON_NO_SECRETS:
+ return "no-secrets";
+ case NM_VPN_CONNECTION_STATE_REASON_LOGIN_FAILED:
+ return "login-failed";
+ case NM_VPN_CONNECTION_STATE_REASON_CONNECTION_REMOVED:
+ return "connection-removed";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
static void
plugin_state_changed (DBusGProxy *proxy,
NMVPNServiceState state,
@@ -504,7 +553,8 @@ plugin_state_changed (DBusGProxy *proxy,
case NM_VPN_CONNECTION_STATE_CONNECT:
case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
case NM_VPN_CONNECTION_STATE_ACTIVATED:
- nm_log_info (LOGD_VPN, "VPN plugin state change reason: %d", priv->failure_reason);
+ nm_log_info (LOGD_VPN, "VPN plugin state change reason: %s (%d)",
+ vpn_reason_to_string (priv->failure_reason), priv->failure_reason);
nm_vpn_connection_set_vpn_state (connection,
NM_VPN_CONNECTION_STATE_FAILED,
priv->failure_reason);
--
1.7.11.7
From 3cebf963da32c610b5607dd5c9ca77054e4fa9c0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ji=C5=99=C3=AD=20Klime=C5=A1?= <jklimes@redhat.com>
Date: Thu, 19 Dec 2013 13:17:44 +0100
Subject: [PATCH 2/2] vpn: add code2string translation for
NMVPNConnectionState and fix its logging
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Signed-off-by: Jiří Klimeš <jklimes@redhat.com>
---
src/vpn-manager/nm-vpn-connection.c | 28 ++++++++++++++++++++++++++--
1 file changed, 26 insertions(+), 2 deletions(-)
diff --git a/src/vpn-manager/nm-vpn-connection.c b/src/vpn-manager/nm-vpn-connection.c
index d0c82e4..500c72b 100644
--- a/src/vpn-manager/nm-vpn-connection.c
+++ b/src/vpn-manager/nm-vpn-connection.c
@@ -477,7 +477,7 @@ plugin_failed (DBusGProxy *proxy,
}
static const char *
-vpn_state_to_string (NMVPNServiceState state)
+vpn_service_state_to_string (NMVPNServiceState state)
{
switch (state) {
case NM_VPN_SERVICE_STATE_INIT:
@@ -499,6 +499,30 @@ vpn_state_to_string (NMVPNServiceState state)
}
static const char *
+vpn_state_to_string (NMVPNConnectionState state)
+{
+ switch (state) {
+ case NM_VPN_CONNECTION_STATE_PREPARE:
+ return "prepare";
+ case NM_VPN_CONNECTION_STATE_NEED_AUTH:
+ return "need-auth";
+ case NM_VPN_CONNECTION_STATE_CONNECT:
+ return "connect";
+ case NM_VPN_CONNECTION_STATE_IP_CONFIG_GET:
+ return "ip-config-get";
+ case NM_VPN_CONNECTION_STATE_ACTIVATED:
+ return "activated";
+ case NM_VPN_CONNECTION_STATE_FAILED:
+ return "failed";
+ case NM_VPN_CONNECTION_STATE_DISCONNECTED:
+ return "disconnected";
+ default:
+ break;
+ }
+ return "unknown";
+}
+
+static const char *
vpn_reason_to_string (NMVPNConnectionStateReason reason)
{
switch (reason) {
@@ -539,7 +563,7 @@ plugin_state_changed (DBusGProxy *proxy,
NMVPNConnectionPrivate *priv = NM_VPN_CONNECTION_GET_PRIVATE (connection);
nm_log_info (LOGD_VPN, "VPN plugin state changed: %s (%d)",
- vpn_state_to_string (state), state);
+ vpn_service_state_to_string (state), state);
if (state == NM_VPN_SERVICE_STATE_STOPPED) {
/* Clear connection secrets to ensure secrets get requested each time the
--
1.7.11.7