[network-manager-openswan] service: always tear down the connection on helper failure



commit 50fc66b5d9a55eddfb38f1f1cd9af9eaefce2f0d
Author: Lubomir Rintel <lkundrak v3 sk>
Date:   Thu Oct 22 13:22:59 2015 +0200

    service: always tear down the connection on helper failure
    
    On connect failure we don't know what state the connection is in, but we want
    to tear down everything that's left and traverse the connect state machine back
    to the beginning so that another connection can succeed.
    
    https://bugzilla.redhat.com/show_bug.cgi?id=1271973

 src/nm-openswan-service.c |   14 +++++---------
 1 files changed, 5 insertions(+), 9 deletions(-)
---
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index 24b32d4..84037ef 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -444,7 +444,6 @@ ipsec_stop (NMOpenSwanPlugin *self, GError **error)
 
 static void
 connect_failed (NMOpenSwanPlugin *self,
-                gboolean do_stop,
                 GError *error,
                 NMVpnConnectionStateReason reason)
 {
@@ -457,8 +456,7 @@ connect_failed (NMOpenSwanPlugin *self,
                           error->message);
        }
 
-       if (do_stop)
-               ipsec_stop (self, NULL);
+       ipsec_stop (self, NULL);
        g_clear_object (&priv->connection);
        nm_vpn_service_plugin_failure (NM_VPN_SERVICE_PLUGIN (self), reason);
 }
@@ -494,7 +492,7 @@ check_running_cb (GPid pid, gint status, gpointer user_data)
                priv->connect_step = CONNECT_STEP_WAIT_READY;
 
        if (!connect_step (self, &error))
-               connect_failed (self, TRUE, error, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
+               connect_failed (self, error, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
 
        g_clear_error (&error);
 }
@@ -509,7 +507,7 @@ retry_cb (gpointer user_data)
        priv->retry_id = 0;
 
        if (!connect_step (self, &error))
-               connect_failed (self, TRUE, error, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
+               connect_failed (self, error, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
        g_clear_error (&error);
 
        return FALSE;
@@ -522,7 +520,6 @@ child_watch_cb (GPid pid, gint status, gpointer user_data)
        NMOpenSwanPluginPrivate *priv = NM_OPENSWAN_PLUGIN_GET_PRIVATE (self);
        guint ret = 1;
        GError *error = NULL;
-       gboolean do_stop = FALSE;
 
        if (priv->watch_id == 0 || priv->pid != pid) {
                /* Reap old child */
@@ -554,7 +551,6 @@ child_watch_cb (GPid pid, gint status, gpointer user_data)
 
        if (ret == 0) {
                /* Success; do the next connect step */
-               do_stop = TRUE;
                priv->connect_step++;
                priv->retries = 0;
                if (!connect_step (self, &error))
@@ -562,7 +558,7 @@ child_watch_cb (GPid pid, gint status, gpointer user_data)
        }
 
        if (ret != 0)
-               connect_failed (self, do_stop, error, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
+               connect_failed (self, error, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
        g_clear_error (&error);
 }
 
@@ -986,7 +982,7 @@ io_cb (GIOChannel *source, GIOCondition condition, gpointer user_data)
 done:
        if (!success) {
                priv->io_id = 0;
-               connect_failed (self, TRUE, NULL, reason);
+               connect_failed (self, NULL, reason);
        }
        return success ? G_SOURCE_CONTINUE : G_SOURCE_REMOVE;
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]