eiwd

no dbus iwd with iwctl functionality
git clone https://git.daat.foo/repos/eiwd.git
Log | Files | Refs | Submodules | README | LICENSE

commit b9029aaf65d87c04d06f4ab87ff49e5dd9f59fd4
parent e678d6655f2f991a8d1efc12911b1af0ca315957
Author: James Prestwood <james.prestwood@linux.intel.com>
Date:   Fri, 26 Oct 2018 09:44:59 -0700

adhoc: wait for both handshakes before adding peer

Adhoc was not waiting for BOTH handshakes to complete before adding the
new peer to the ConnectedPeers property. Actually waiting for the gtk/igtk
(in a previous commit) helps with this, but adhoc also needed to keep track
of which handshakes had completed, and only add the peer once BOTH were done.
This required a small change in netdev, where we memcmp the addresses from
both handshakes and only set the PTK on one.

Diffstat:
Msrc/adhoc.c | 11+++++++++--
Msrc/netdev.c | 5++++-
2 files changed, 13 insertions(+), 3 deletions(-)

diff --git 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 @@ -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);