[NetworkManager-libreswan/nm-1-0: 48/51] service: tolerate non-zero from ipsec auto --ready
- From: Thomas Haller <thaller src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [NetworkManager-libreswan/nm-1-0: 48/51] service: tolerate non-zero from ipsec auto --ready
- Date: Thu, 4 Oct 2018 14:09:43 +0000 (UTC)
commit 0d73bef35688faf442414be545e2aa0cdef10118
Author: Lubomir Rintel <lkundrak v3 sk>
Date: Wed Nov 4 14:00:04 2015 +0100
service: tolerate non-zero from ipsec auto --ready
It returns status=3 if the daemon is ready, but failed to listen on some
addresses. Libreswan doesn't seem too good about picking the correct
addresses to listen on. It returns status=1 if it couldn't connect to
the control socket.
https://github.com/libreswan/libreswan/pull/42
(cherry picked from commit 153b75cdfec81e792adbd26f5e21b12f071dfc1b)
src/nm-openswan-service.c | 24 ++++++++++++++----------
1 file changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c
index c5059e4..85c145b 100644
--- a/src/nm-openswan-service.c
+++ b/src/nm-openswan-service.c
@@ -521,6 +521,7 @@ 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 success;
if (priv->watch_id == 0 || priv->pid != pid) {
/* Reap old child */
@@ -543,23 +544,26 @@ child_watch_cb (GPid pid, gint status, gpointer user_data)
/* Reap child */
waitpid (pid, NULL, WNOHANG);
- if (ret != 0 && priv->retries) {
- priv->retries--;
- g_message ("Spawn: %d more tries...", priv->retries);
- priv->retry_id = g_timeout_add (100, retry_cb, self);
- return;
- }
+ if (priv->connect_step == CONNECT_STEP_WAIT_READY)
+ success = (ret != 1);
+ else
+ success = (ret == 0);
- if (ret == 0) {
+ if (success) {
/* Success; do the next connect step */
priv->connect_step++;
priv->retries = 0;
- if (!connect_step (self, &error))
- ret = 1;
+ success = connect_step (self, &error);
+ } else if (priv->retries) {
+ priv->retries--;
+ g_message ("Spawn: %d more tries...", priv->retries);
+ priv->retry_id = g_timeout_add (100, retry_cb, self);
+ return;
}
- if (ret != 0)
+ if (!success)
connect_failed (self, error, NM_VPN_PLUGIN_FAILURE_CONNECT_FAILED);
+
g_clear_error (&error);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]