diff options
author | Thomas Haller <thaller@redhat.com> | 2018-09-14 11:53:27 +0200 |
---|---|---|
committer | Thomas Haller <thaller@redhat.com> | 2018-09-14 15:24:31 +0200 |
commit | 011dd919fa6f6923a0d1f9596283578caaf8a88c (patch) | |
tree | f2e44e5832f904b4a01c136446027eb5d62ff1fe /src/vpn | |
parent | 6bfab6796f064c4f878e05476a60cd59fa8bf11e (diff) | |
download | NetworkManager-011dd919fa6f6923a0d1f9596283578caaf8a88c.tar.gz |
vpn: fix assertion during "SecretsRequired" in unexpected state
Got this assertion:
NetworkManager[12939]: <debug> [1536917977.4868] active-connection[0x563d8fd34540]: set state deactivated (was deactivating)
...
NetworkManager[12939]: nm-openvpn[1106] <info> openvpn[1132]: send SIGTERM
NetworkManager[12939]: nm-openvpn[1106] <info> wait for 1 openvpn processes to terminate...
NetworkManager[12939]: nm-openvpn[1106] <warn> openvpn[1132] exited with error code 1
NetworkManager[12939]: <info> [1536917977.5035] vpn-connection[0x563d8fd34540,2fdeaea3-975f-4325-8305-83ebca5eaa26,"my-openvpn-Red-Hat",0]: VPN plugin: requested secrets; state disconnected (9)
NetworkManager[12939]: plugin_interactive_secrets_required: assertion 'priv->vpn_state == STATE_CONNECT || priv->vpn_state == STATE_NEED_AUTH' failed
Meaning. We should either ensure that secrets_required_cb() signal callback
is disconnected from proxy's signal, or we gracefully handle callbacks at
unexpected moments. Do the latter.
(cherry picked from commit 92344dd0848f2353b81eab5b0b294eb92aaf59c0)
Diffstat (limited to 'src/vpn')
-rw-r--r-- | src/vpn/nm-vpn-connection.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/vpn/nm-vpn-connection.c b/src/vpn/nm-vpn-connection.c index d1aaa7c991..3a866200c0 100644 --- a/src/vpn/nm-vpn-connection.c +++ b/src/vpn/nm-vpn-connection.c @@ -2684,12 +2684,16 @@ plugin_interactive_secrets_required (NMVpnConnection *self, gs_free const char **hints = NULL; gs_free char *message_hint = NULL; + if (!NM_IN_SET (priv->vpn_state, STATE_CONNECT, + STATE_NEED_AUTH)) { + _LOGD ("VPN plugin: requested secrets; state %s (%d); ignore request in current state", + vpn_state_to_string (priv->vpn_state), priv->vpn_state); + return; + } + _LOGI ("VPN plugin: requested secrets; state %s (%d)", vpn_state_to_string (priv->vpn_state), priv->vpn_state); - g_return_if_fail (priv->vpn_state == STATE_CONNECT || - priv->vpn_state == STATE_NEED_AUTH); - priv->secrets_idx = SECRETS_REQ_INTERACTIVE; _set_vpn_state (self, STATE_NEED_AUTH, NM_ACTIVE_CONNECTION_STATE_REASON_NONE, FALSE); |