mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-25 04:50:07 +01:00
merge: branch 'bg/rh2174353'
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1589 https://bugzilla.redhat.com/show_bug.cgi?id=2174353
This commit is contained in:
commit
37de834575
3 changed files with 54 additions and 31 deletions
|
|
@ -5978,6 +5978,55 @@ fail:
|
|||
error_desc ?: error->message);
|
||||
}
|
||||
|
||||
void
|
||||
nm_manager_deactivate_ac(NMManager *self, NMSettingsConnection *connection)
|
||||
{
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self);
|
||||
NMActiveConnection *ac;
|
||||
const CList *tmp_list, *tmp_safe;
|
||||
GError *error = NULL;
|
||||
AsyncOpData *async_op_data;
|
||||
AsyncOpData *async_op_data_safe;
|
||||
|
||||
nm_assert(NM_IS_SETTINGS_CONNECTION(connection));
|
||||
|
||||
nm_manager_for_each_active_connection_safe (self, ac, tmp_list, tmp_safe) {
|
||||
if (nm_active_connection_get_settings_connection(ac) == connection
|
||||
&& (nm_active_connection_get_state(ac) <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)) {
|
||||
if (!nm_manager_deactivate_connection(self,
|
||||
ac,
|
||||
NM_DEVICE_STATE_REASON_CONNECTION_REMOVED,
|
||||
&error)) {
|
||||
_LOGW(LOGD_DEVICE,
|
||||
"connection '%s' disappeared, but error deactivating it: (%d) %s",
|
||||
nm_settings_connection_get_id(connection),
|
||||
error ? error->code : -1,
|
||||
error ? error->message : "(unknown)");
|
||||
g_clear_error(&error);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
c_list_for_each_entry_safe (async_op_data,
|
||||
async_op_data_safe,
|
||||
&priv->async_op_lst_head,
|
||||
async_op_lst) {
|
||||
if (!NM_IN_SET(async_op_data->async_op_type,
|
||||
ASYNC_OP_TYPE_AC_AUTH_ACTIVATE_INTERNAL,
|
||||
ASYNC_OP_TYPE_AC_AUTH_ACTIVATE_USER,
|
||||
ASYNC_OP_TYPE_AC_AUTH_ADD_AND_ACTIVATE,
|
||||
ASYNC_OP_TYPE_AC_AUTH_ADD_AND_ACTIVATE2))
|
||||
continue;
|
||||
|
||||
ac = async_op_data->ac_auth.active;
|
||||
if (nm_active_connection_get_settings_connection(ac) == connection) {
|
||||
nm_active_connection_set_state(ac,
|
||||
NM_ACTIVE_CONNECTION_STATE_DEACTIVATED,
|
||||
NM_ACTIVE_CONNECTION_STATE_REASON_CONNECTION_REMOVED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* nm_manager_activate_connection():
|
||||
* @self: the #NMManager
|
||||
|
|
|
|||
|
|
@ -121,6 +121,8 @@ NMSettingsConnection **nm_manager_get_activatable_connections(NMManager *manager
|
|||
gboolean sort,
|
||||
guint *out_len);
|
||||
|
||||
void nm_manager_deactivate_ac(NMManager *self, NMSettingsConnection *connection);
|
||||
|
||||
void nm_manager_write_device_state_all(NMManager *manager);
|
||||
gboolean nm_manager_write_device_state(NMManager *manager, NMDevice *device, int *out_ifindex);
|
||||
|
||||
|
|
|
|||
|
|
@ -1326,7 +1326,8 @@ pending_ac_state_changed(NMActiveConnection *ac, guint state, guint reason, NMPo
|
|||
* device, but block the current connection to avoid an activation
|
||||
* loop.
|
||||
*/
|
||||
if (reason != NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED) {
|
||||
if (reason != NM_ACTIVE_CONNECTION_STATE_REASON_DEVICE_DISCONNECTED
|
||||
&& reason != NM_ACTIVE_CONNECTION_STATE_REASON_CONNECTION_REMOVED) {
|
||||
con = nm_active_connection_get_settings_connection(ac);
|
||||
nm_manager_devcon_autoconnect_blocked_reason_set(
|
||||
priv->manager,
|
||||
|
|
@ -2624,41 +2625,12 @@ connection_updated(NMSettings *settings,
|
|||
schedule_activate_all(self);
|
||||
}
|
||||
|
||||
static void
|
||||
_deactivate_if_active(NMPolicy *self, NMSettingsConnection *connection)
|
||||
{
|
||||
NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
|
||||
NMActiveConnection *ac;
|
||||
const CList *tmp_list, *tmp_safe;
|
||||
GError *error = NULL;
|
||||
|
||||
nm_assert(NM_IS_SETTINGS_CONNECTION(connection));
|
||||
|
||||
nm_manager_for_each_active_connection_safe (priv->manager, ac, tmp_list, tmp_safe) {
|
||||
if (nm_active_connection_get_settings_connection(ac) == connection
|
||||
&& (nm_active_connection_get_state(ac) <= NM_ACTIVE_CONNECTION_STATE_ACTIVATED)) {
|
||||
if (!nm_manager_deactivate_connection(priv->manager,
|
||||
ac,
|
||||
NM_DEVICE_STATE_REASON_CONNECTION_REMOVED,
|
||||
&error)) {
|
||||
_LOGW(LOGD_DEVICE,
|
||||
"connection '%s' disappeared, but error deactivating it: (%d) %s",
|
||||
nm_settings_connection_get_id(connection),
|
||||
error ? error->code : -1,
|
||||
error ? error->message : "(unknown)");
|
||||
g_clear_error(&error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
connection_removed(NMSettings *settings, NMSettingsConnection *connection, gpointer user_data)
|
||||
{
|
||||
NMPolicyPrivate *priv = user_data;
|
||||
NMPolicy *self = _PRIV_TO_SELF(priv);
|
||||
|
||||
_deactivate_if_active(self, connection);
|
||||
nm_manager_deactivate_ac(priv->manager, connection);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue