device: fix removal of pacrunner configurations

Don't try to remove the configuration if we haven't added it in the
first place, for example when the connection gets deactivated before
it completes or for slave connections without IP configuration.

Fixes: 3ad89223d0
This commit is contained in:
Beniamino Galvani 2017-04-07 10:23:22 +02:00
parent ab47a2d5fe
commit 3cada7722d
2 changed files with 17 additions and 4 deletions

View file

@ -322,6 +322,7 @@ typedef struct _NMDevicePrivate {
/* Proxy Configuration */
NMProxyConfig *proxy_config;
NMPacrunnerManager *pacrunner_manager;
bool proxy_config_sent;
/* IP4 configuration info */
NMIP4Config * ip4_config; /* Combined config from VPN, settings, and device */
@ -8839,6 +8840,9 @@ reactivate_proxy_config (NMDevice *self)
{
NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE (self);
if (!priv->proxy_config_sent)
return;
nm_pacrunner_manager_remove (priv->pacrunner_manager,
nm_device_get_ip_iface (self));
@ -12509,8 +12513,11 @@ _set_state_full (NMDevice *self,
}
}
/* Remove config from PacRunner */
nm_pacrunner_manager_remove (priv->pacrunner_manager, nm_device_get_ip_iface (self));
if (priv->proxy_config_sent) {
nm_pacrunner_manager_remove (priv->pacrunner_manager,
nm_device_get_ip_iface (self));
priv->proxy_config_sent = FALSE;
}
break;
case NM_DEVICE_STATE_DISCONNECTED:
if ( priv->queued_act_request
@ -12542,6 +12549,7 @@ _set_state_full (NMDevice *self,
priv->proxy_config,
NULL,
NULL);
priv->proxy_config_sent = TRUE;
}
break;
case NM_DEVICE_STATE_FAILED:

View file

@ -127,6 +127,7 @@ typedef struct {
GVariant *connect_hash;
guint connect_timeout;
NMProxyConfig *proxy_config;
gboolean proxy_config_sent;
gboolean has_ip4;
NMIP4Config *ip4_config;
guint32 ip4_internal_gw;
@ -578,6 +579,7 @@ _set_vpn_state (NMVpnConnection *self,
priv->proxy_config,
priv->ip4_config,
priv->ip6_config);
priv->proxy_config_sent = TRUE;
}
break;
case STATE_DEACTIVATING:
@ -608,8 +610,11 @@ _set_vpn_state (NMVpnConnection *self,
}
}
/* Remove config from PacRunner */
nm_pacrunner_manager_remove (nm_pacrunner_manager_get(), nm_connection_get_uuid (applied));
if (priv->proxy_config_sent) {
nm_pacrunner_manager_remove (nm_pacrunner_manager_get(),
nm_connection_get_uuid (applied));
priv->proxy_config_sent = FALSE;
}
break;
case STATE_FAILED:
case STATE_DISCONNECTED: