vpn: ensure the IP interface passed to the dispatcher is the tunnel iface
priv->ip_iface gets destroyed in vpn_cleanup() when the class signal handler handles FAILED/DISCONNECTED, but the dispatcher is only called *after* that, so it gets a NULL ip_iface. Fix that so that the dispatcher always gets the tunnel interface for vpn-up and vpn-down.
This commit is contained in:
@@ -119,6 +119,7 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection,
|
|||||||
NMVPNConnectionPrivate *priv;
|
NMVPNConnectionPrivate *priv;
|
||||||
NMActiveConnectionState new_ac_state;
|
NMActiveConnectionState new_ac_state;
|
||||||
NMVPNConnectionState old_vpn_state;
|
NMVPNConnectionState old_vpn_state;
|
||||||
|
char *ip_iface;
|
||||||
|
|
||||||
g_return_if_fail (NM_IS_VPN_CONNECTION (connection));
|
g_return_if_fail (NM_IS_VPN_CONNECTION (connection));
|
||||||
|
|
||||||
@@ -130,6 +131,11 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection,
|
|||||||
old_vpn_state = priv->vpn_state;
|
old_vpn_state = priv->vpn_state;
|
||||||
priv->vpn_state = vpn_state;
|
priv->vpn_state = vpn_state;
|
||||||
|
|
||||||
|
/* Save ip_iface since when the VPN goes down it may get freed
|
||||||
|
* before we're done with it.
|
||||||
|
*/
|
||||||
|
ip_iface = g_strdup (priv->ip_iface);
|
||||||
|
|
||||||
/* Set the NMActiveConnection state based on VPN state */
|
/* Set the NMActiveConnection state based on VPN state */
|
||||||
switch (vpn_state) {
|
switch (vpn_state) {
|
||||||
case NM_VPN_CONNECTION_STATE_PREPARE:
|
case NM_VPN_CONNECTION_STATE_PREPARE:
|
||||||
@@ -166,7 +172,7 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection,
|
|||||||
nm_utils_call_dispatcher ("vpn-up",
|
nm_utils_call_dispatcher ("vpn-up",
|
||||||
priv->connection,
|
priv->connection,
|
||||||
priv->parent_dev,
|
priv->parent_dev,
|
||||||
priv->ip_iface);
|
ip_iface);
|
||||||
break;
|
break;
|
||||||
case NM_VPN_CONNECTION_STATE_FAILED:
|
case NM_VPN_CONNECTION_STATE_FAILED:
|
||||||
case NM_VPN_CONNECTION_STATE_DISCONNECTED:
|
case NM_VPN_CONNECTION_STATE_DISCONNECTED:
|
||||||
@@ -174,13 +180,14 @@ nm_vpn_connection_set_vpn_state (NMVPNConnection *connection,
|
|||||||
nm_utils_call_dispatcher ("vpn-down",
|
nm_utils_call_dispatcher ("vpn-down",
|
||||||
priv->connection,
|
priv->connection,
|
||||||
priv->parent_dev,
|
priv->parent_dev,
|
||||||
priv->ip_iface);
|
ip_iface);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
g_free (ip_iface);
|
||||||
g_object_unref (connection);
|
g_object_unref (connection);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user