diff options
author | Dan Williams <dcbw@redhat.com> | 2014-09-26 16:03:06 -0500 |
---|---|---|
committer | Dan Williams <dcbw@redhat.com> | 2014-11-06 21:17:34 -0600 |
commit | 6cbbb9c0bbdfb3784260fb644fd02ca518efdba5 (patch) | |
tree | c863ca62b1e3e4126c2cbf3b7353e7cff71b0e46 /src/nm-policy.c | |
parent | b11798a196bc3cda29e0b0540bc19eef7c09a207 (diff) | |
download | NetworkManager-6cbbb9c0bbdfb3784260fb644fd02ca518efdba5.tar.gz |
vpn: reconnect on service failures (bgo #349151)
Attempt to reconnect the VPN on failures, except when the underlying
device fails.
https://bugzilla.gnome.org/show_bug.cgi?id=349151
Diffstat (limited to 'src/nm-policy.c')
-rw-r--r-- | src/nm-policy.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/nm-policy.c b/src/nm-policy.c index ca2d340b59..e21df28a9c 100644 --- a/src/nm-policy.c +++ b/src/nm-policy.c @@ -1836,6 +1836,28 @@ vpn_connection_state_changed (NMVpnConnection *vpn, } static void +vpn_connection_retry_after_failure (NMVpnConnection *vpn, NMPolicy *policy) +{ + NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (policy); + NMActiveConnection *ac = NM_ACTIVE_CONNECTION (vpn); + NMConnection *connection = nm_active_connection_get_connection (ac); + GError *error = NULL; + + /* Attempt to reconnect VPN connections that failed after being connected */ + if (!nm_manager_activate_connection (priv->manager, + connection, + NULL, + NULL, + nm_active_connection_get_subject (ac), + &error)) { + nm_log_warn (LOGD_DEVICE, "VPN '%s' reconnect failed: %s", + nm_connection_get_id (connection), + error->message ? error->message : "unknown"); + g_clear_error (&error); + } +} + +static void active_connection_state_changed (NMActiveConnection *active, GParamSpec *pspec, NMPolicy *policy) @@ -1859,6 +1881,9 @@ active_connection_added (NMManager *manager, g_signal_connect (active, NM_VPN_CONNECTION_INTERNAL_STATE_CHANGED, G_CALLBACK (vpn_connection_state_changed), policy); + g_signal_connect (active, NM_VPN_CONNECTION_INTERNAL_RETRY_AFTER_FAILURE, + G_CALLBACK (vpn_connection_retry_after_failure), + policy); } g_signal_connect (active, "notify::" NM_ACTIVE_CONNECTION_STATE, @@ -1877,6 +1902,9 @@ active_connection_removed (NMManager *manager, vpn_connection_state_changed, policy); g_signal_handlers_disconnect_by_func (active, + vpn_connection_retry_after_failure, + policy); + g_signal_handlers_disconnect_by_func (active, active_connection_state_changed, policy); } |