mirror of
https://git.kernel.org/pub/scm/network/wireless/iwd.git
synced 2024-12-21 03:32:42 +01:00
netdev: keep track of operational state
We should not attempt to call connect_failed if we're have become operational. E.g. successfully associated, ran eapol if necessary and set operstate.
This commit is contained in:
parent
2d87556b6b
commit
886ffc2edb
13
src/netdev.c
13
src/netdev.c
@ -75,6 +75,7 @@ struct netdev {
|
|||||||
uint32_t next_watch_id;
|
uint32_t next_watch_id;
|
||||||
|
|
||||||
bool connected : 1;
|
bool connected : 1;
|
||||||
|
bool operational : 1;
|
||||||
bool eapol_active : 1;
|
bool eapol_active : 1;
|
||||||
bool rekey_offload_support : 1;
|
bool rekey_offload_support : 1;
|
||||||
};
|
};
|
||||||
@ -280,6 +281,7 @@ static void netdev_connect_free(struct netdev *netdev)
|
|||||||
netdev->eapol_active = false;
|
netdev->eapol_active = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
netdev->operational = false;
|
||||||
netdev->connected = false;
|
netdev->connected = false;
|
||||||
netdev->connect_cb = NULL;
|
netdev->connect_cb = NULL;
|
||||||
netdev->event_filter = NULL;
|
netdev->event_filter = NULL;
|
||||||
@ -562,6 +564,8 @@ static void netdev_operstate_cb(bool success, void *user_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
netdev->operational = true;
|
||||||
|
|
||||||
if (netdev->connect_cb) {
|
if (netdev->connect_cb) {
|
||||||
netdev->connect_cb(netdev, NETDEV_RESULT_OK, netdev->user_data);
|
netdev->connect_cb(netdev, NETDEV_RESULT_OK, netdev->user_data);
|
||||||
netdev->connect_cb = NULL;
|
netdev->connect_cb = NULL;
|
||||||
@ -1205,8 +1209,13 @@ int netdev_disconnect(struct netdev *netdev,
|
|||||||
if (netdev->disconnect_cmd_id)
|
if (netdev->disconnect_cmd_id)
|
||||||
return -EINPROGRESS;
|
return -EINPROGRESS;
|
||||||
|
|
||||||
netdev->result = NETDEV_RESULT_ABORTED;
|
/* Only perform this if we haven't successfully fully associated yet */
|
||||||
netdev_connect_failed(NULL, netdev);
|
if (!netdev->operational) {
|
||||||
|
netdev->result = NETDEV_RESULT_ABORTED;
|
||||||
|
netdev_connect_failed(NULL, netdev);
|
||||||
|
} else {
|
||||||
|
netdev_connect_free(netdev);
|
||||||
|
}
|
||||||
|
|
||||||
deauthenticate = netdev_build_cmd_deauthenticate(netdev,
|
deauthenticate = netdev_build_cmd_deauthenticate(netdev,
|
||||||
MPDU_REASON_CODE_DEAUTH_LEAVING);
|
MPDU_REASON_CODE_DEAUTH_LEAVING);
|
||||||
|
Loading…
Reference in New Issue
Block a user