diff --git a/src/adhoc.c b/src/adhoc.c index 69de257a..ec89bc34 100644 --- a/src/adhoc.c +++ b/src/adhoc.c @@ -67,7 +67,8 @@ struct sta_state { struct eapol_sm *sm_a; struct handshake_state *hs_auth; uint32_t gtk_query_cmd_id; - + bool hs_sta_done : 1; + bool hs_auth_done : 1; bool authenticated : 1; }; @@ -183,7 +184,13 @@ static void adhoc_handshake_event(struct handshake_state *hs, return; case HANDSHAKE_EVENT_COMPLETE: - if ((sta->hs_auth == hs || sta->hs_sta == hs) && + if (sta->hs_auth == hs) + sta->hs_auth_done = true; + + if (sta->hs_sta == hs) + sta->hs_sta_done = true; + + if ((sta->hs_auth_done && sta->hs_sta_done) && !sta->authenticated) { sta->authenticated = true; l_dbus_property_changed(dbus_get_bus(), diff --git a/src/netdev.c b/src/netdev.c index b1c04f3e..07845b0c 100644 --- a/src/netdev.c +++ b/src/netdev.c @@ -1425,8 +1425,11 @@ static void netdev_set_tk(struct handshake_state *hs, * by the STA Authenticator with the higher MAC address... */ if (netdev->type == NL80211_IFTYPE_ADHOC && - memcmp(nhs->super.aa, nhs->super.spa, 6) < 0) + memcmp(nhs->super.aa, nhs->super.spa, 6) < 0) { + nhs->ptk_installed = true; + try_handshake_complete(nhs); return; + } l_debug("%d", netdev->index);