mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-03-04 21:10:39 +01:00
device: block autoconnect of profile when deleting device
Currently, when we delete a device then autoconnect does not kick in
right away. But that is only, because we happen not to schedule a
"autoactivate" recheck.
What should be happen, is that rechecking whether to autoconnect is
always allowed, and that we have the necessary state to know that
autoconnect currently should not work.
Instead, block autoconnect of the involved profile. That makes sense,
because clearly we don't want to autoconnect right again after `nmcli
device delete $iface`.
(cherry picked from commit 14d429dd17)
(cherry picked from commit 53a3368bd600746c30798fb95113a8ccc5d48de3)
This commit is contained in:
parent
d07827dfe1
commit
f3a68c88a4
1 changed files with 15 additions and 1 deletions
|
|
@ -13414,7 +13414,8 @@ delete_cb(NMDevice *self,
|
|||
GError *error,
|
||||
gpointer user_data)
|
||||
{
|
||||
GError *local = NULL;
|
||||
NMSettingsConnection *sett_conn;
|
||||
GError *local = NULL;
|
||||
|
||||
if (error) {
|
||||
g_dbus_method_invocation_return_gerror(context, error);
|
||||
|
|
@ -13430,6 +13431,19 @@ delete_cb(NMDevice *self,
|
|||
/* Authorized */
|
||||
nm_audit_log_device_op(NM_AUDIT_OP_DEVICE_DELETE, self, TRUE, NULL, subject, NULL);
|
||||
|
||||
sett_conn = nm_device_get_settings_connection(self);
|
||||
if (sett_conn) {
|
||||
/* Block profile from autoconnecting. We block the profile, which may
|
||||
* be ugly/wrong with multi-connect profiles. However, it's not
|
||||
* obviously wrong, because profiles for software devices tend not to
|
||||
* work with multi-connect anyway, because they describe a (unique)
|
||||
* interface by name. */
|
||||
nm_settings_connection_autoconnect_blocked_reason_set(
|
||||
sett_conn,
|
||||
NM_SETTINGS_AUTO_CONNECT_BLOCKED_REASON_USER_REQUEST,
|
||||
TRUE);
|
||||
}
|
||||
|
||||
if (!nm_device_unrealize(self, TRUE, &local)) {
|
||||
g_dbus_method_invocation_take_error(context, local);
|
||||
return;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue