mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 22:48:01 +02:00
iwd: Wait for disconnect to finish
In a previous patch I added deactivate_async to make sure that NM
auto re-connect waits for the IWD state to changed from "disconnecting"
to "disconnected" before starting a new activation when the user wants
to switch from one profile to another. This doesn't account for when
IWD itself goes into "disconnecting" because of a connect failure.
When IWD goes into the "disconnecting" state we call
nm_device_state_changed (NM_DEVICE_STATE_FAILED,
NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT)
immediately to give feedback to user as soon as possible. We will
return FALSE from get_autoconnect_allowed for the period the
"disconnecting" state.
This commit is contained in:
parent
bcf3b10284
commit
c95c27a099
1 changed files with 19 additions and 0 deletions
|
|
@ -77,6 +77,7 @@ typedef struct {
|
|||
NMActRequestGetSecretsCallId *wifi_secrets_id;
|
||||
bool enabled:1;
|
||||
bool can_scan:1;
|
||||
bool can_connect:1;
|
||||
bool scanning:1;
|
||||
} NMDeviceIwdPrivate;
|
||||
|
||||
|
|
@ -767,6 +768,15 @@ is_available (NMDevice *device, NMDeviceCheckDevAvailableFlags flags)
|
|||
return priv->enabled && priv->dbus_obj;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
get_autoconnect_allowed (NMDevice *device)
|
||||
{
|
||||
NMDeviceIwdPrivate *priv;
|
||||
|
||||
priv = NM_DEVICE_IWD_GET_PRIVATE (NM_DEVICE_IWD (device));
|
||||
return priv->enabled && priv->dbus_obj && priv->can_connect;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
can_auto_connect (NMDevice *device,
|
||||
NMConnection *connection,
|
||||
|
|
@ -1637,6 +1647,7 @@ state_changed (NMDeviceIwd *self, const gchar *new_state)
|
|||
NMDevice *device = NM_DEVICE (self);
|
||||
NMDeviceState dev_state = nm_device_get_state (device);
|
||||
gboolean iwd_connection = FALSE;
|
||||
gboolean can_connect;
|
||||
|
||||
_LOGI (LOGD_DEVICE | LOGD_WIFI, "new IWD device state is %s", new_state);
|
||||
|
||||
|
|
@ -1648,6 +1659,13 @@ state_changed (NMDeviceIwd *self, const gchar *new_state)
|
|||
/* Don't allow scanning while connecting, disconnecting or roaming */
|
||||
priv->can_scan = NM_IN_STRSET (new_state, "connected", "disconnected");
|
||||
|
||||
/* Don't allow new connection until iwd exits disconnecting */
|
||||
can_connect = NM_IN_STRSET (new_state, "disconnected");
|
||||
if (can_connect != priv->can_connect) {
|
||||
priv->can_connect = can_connect;
|
||||
nm_device_emit_recheck_auto_activate (device);
|
||||
}
|
||||
|
||||
if (NM_IN_STRSET (new_state, "connecting", "connected", "roaming")) {
|
||||
/* If we were connecting, do nothing, the confirmation of
|
||||
* a connection success is handled in the Device.Connect
|
||||
|
|
@ -1884,6 +1902,7 @@ nm_device_iwd_class_init (NMDeviceIwdClass *klass)
|
|||
|
||||
parent_class->can_auto_connect = can_auto_connect;
|
||||
parent_class->is_available = is_available;
|
||||
parent_class->get_autoconnect_allowed = get_autoconnect_allowed;
|
||||
parent_class->check_connection_compatible = check_connection_compatible;
|
||||
parent_class->check_connection_available = check_connection_available;
|
||||
parent_class->complete_connection = complete_connection;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue