netdev: Tweak netdev_disconnect semantics

If the handshake fails, we trigger a deauthentication prior to reporting
NETDEV_RESULT_HANDSHAKE_FAILED.  If a netdev_disconnect is invoked in
the meantime, then the caller will receive -ENOTCONN.  This is
incorrect, since we are in fact logically connected until the connect_cb
is notified.

Tweak the behavior to keep the connected variable as true, but check
whether disconnect_cmd_id has been issued in the netdev_disconnect_event
callback.
This commit is contained in:
Denis Kenzior 2016-09-22 17:23:49 -05:00
parent 9c2d61db2c
commit 5329ddceb8
1 changed files with 1 additions and 2 deletions

View File

@ -468,7 +468,7 @@ static void netdev_disconnect_event(struct l_genl_msg *msg,
l_debug("");
if (!netdev->connected)
if (!netdev->connected || netdev->disconnect_cmd_id > 0)
return;
if (!l_genl_attr_init(&attr, msg)) {
@ -905,7 +905,6 @@ static void netdev_handshake_failed(uint32_t ifindex,
l_error("4-Way Handshake failed for ifindex: %d", ifindex);
netdev->eapol_active = false;
netdev->connected = false;
netdev->result = NETDEV_RESULT_HANDSHAKE_FAILED;
msg = netdev_build_cmd_deauthenticate(netdev, reason_code);