mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-09 08:18:03 +02:00
policy: don't block autoconnect for connections when disconnecting software devices
This was added by commit979b8920b4(core: move virtual device autoconnect tracking bits out of NMManager) to avoid autoconnecting software devices repeatedly. That was done, because disconnecting a software device would delete the NMDevice instance, and there is no property on a device to prevent autoconnect. In the meantime, we only unrealize software devices and don't delete them entirely. Also, the autoconnect-blocked flags of the device are preserved when the device unrealized. It was anyway odd, that deactivating one software-device would block autoconnection for all matching connections. (cherry picked from commit146fbfab33)
This commit is contained in:
parent
186d9de66a
commit
8f131e4e18
1 changed files with 6 additions and 39 deletions
|
|
@ -1466,34 +1466,6 @@ reset_autoconnect_for_failed_secrets (NMPolicy *self)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
block_autoconnect_for_device (NMPolicy *self, NMDevice *device)
|
|
||||||
{
|
|
||||||
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE (self);
|
|
||||||
gs_free NMSettingsConnection **connections = NULL;
|
|
||||||
guint i;
|
|
||||||
|
|
||||||
_LOGD (LOGD_DEVICE, "blocking autoconnect for all connections on %s",
|
|
||||||
nm_device_get_iface (device));
|
|
||||||
|
|
||||||
/* NMDevice keeps its own autoconnect-able-ness state; we only need to
|
|
||||||
* explicitly block connections for software devices, where the NMDevice
|
|
||||||
* might be destroyed and recreated later.
|
|
||||||
*/
|
|
||||||
if (!nm_device_is_software (device))
|
|
||||||
return;
|
|
||||||
|
|
||||||
connections = nm_settings_get_connections_sorted (priv->settings, NULL);
|
|
||||||
for (i = 0; connections[i]; i++) {
|
|
||||||
NMSettingsConnection *connection = connections[i];
|
|
||||||
|
|
||||||
if (nm_device_check_connection_compatible (device, NM_CONNECTION (connection))) {
|
|
||||||
nm_settings_connection_autoconnect_blocked_reason_set (connection,
|
|
||||||
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
sleeping_changed (NMManager *manager, GParamSpec *pspec, gpointer user_data)
|
sleeping_changed (NMManager *manager, GParamSpec *pspec, gpointer user_data)
|
||||||
{
|
{
|
||||||
|
|
@ -1844,17 +1816,12 @@ device_state_changed (NMDevice *device,
|
||||||
break;
|
break;
|
||||||
case NM_DEVICE_STATE_DEACTIVATING:
|
case NM_DEVICE_STATE_DEACTIVATING:
|
||||||
if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_USER_REQUESTED) {
|
if (nm_device_state_reason_check (reason) == NM_DEVICE_STATE_REASON_USER_REQUESTED) {
|
||||||
if (nm_device_autoconnect_blocked_get (device, NM_DEVICE_AUTOCONNECT_BLOCKED_ALL)) {
|
if (connection) {
|
||||||
/* The device was disconnected; block all connections on it */
|
/* The connection was deactivated, so block just this connection */
|
||||||
block_autoconnect_for_device (self, device);
|
_LOGD (LOGD_DEVICE, "blocking autoconnect of connection '%s' by user request",
|
||||||
} else {
|
nm_settings_connection_get_id (connection));
|
||||||
if (connection) {
|
nm_settings_connection_autoconnect_blocked_reason_set (connection,
|
||||||
/* The connection was deactivated, so block just this connection */
|
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST);
|
||||||
_LOGD (LOGD_DEVICE, "blocking autoconnect of connection '%s' by user request",
|
|
||||||
nm_settings_connection_get_id (connection));
|
|
||||||
nm_settings_connection_autoconnect_blocked_reason_set (connection,
|
|
||||||
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ip6_remove_device_prefix_delegations (self, device);
|
ip6_remove_device_prefix_delegations (self, device);
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue