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

View file

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