From 5329ddceb88622faa6bb0d7514190843ad26c699 Mon Sep 17 00:00:00 2001 From: Denis Kenzior Date: Thu, 22 Sep 2016 17:23:49 -0500 Subject: [PATCH] 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. --- src/netdev.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/netdev.c b/src/netdev.c index c053eb19..14291474 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -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);