eiwd

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

commit a90c4025f1eed8665a36b607fe06ecb371ee6c6f
parent ed10b00afa3f4c087b46d7ba0b60a47bd05d8b39
Author: Andrew Zaborowski <andrew.zaborowski@intel.com>
Date:   Mon, 23 Aug 2021 16:14:22 +0200

handshake: Add HANDSHAKE_EVENT_P2P_IP_REQUEST

Add a handshake event for use by the AP side for mechanisms that
allocate client IPs during the handshake: P2P address allocation and
FILS address assignment.  This is emitted only when EAPOL or the
auth_proto is actually about to send the network configuration data to
the client so that ap.c can skip allocating a DHCP leases altogether if
the client doesn't send the required KDE or IE.

Diffstat:
Msrc/eapol.c | 17+++++++++++++++++
Msrc/handshake.h | 1+
Msrc/station.c | 1+
3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/src/eapol.c b/src/eapol.c @@ -1350,6 +1350,23 @@ static void eapol_send_ptk_3_of_4(struct eapol_sm *sm) key_data_len += gtk_kde[1] + 2; } + if (sm->handshake->support_ip_allocation && + !sm->handshake->client_ip_addr) { + handshake_event(sm->handshake, HANDSHAKE_EVENT_P2P_IP_REQUEST); + + /* + * If .support_ip_allocation was set, the + * HANDSHAKE_EVENT_P2P_IP_REQUEST handler is expected to set + * .client_ip_addr if not already set. Check if the handler + * was successful in allocating an address, if it wasn't we'll + * just skip the IP Address Allocation KDE. In either case if + * we need to resend message 3/4 the event callback won't be + * triggered again because the condition above will be false. + */ + if (!sm->handshake->client_ip_addr) + sm->handshake->support_ip_allocation = false; + } + if (sm->handshake->support_ip_allocation) { /* Wi-Fi P2P Technical Specification v1.7 Table 59 */ key_data_buf[key_data_len++] = IE_TYPE_VENDOR_SPECIFIC; diff --git a/src/handshake.h b/src/handshake.h @@ -57,6 +57,7 @@ enum handshake_event { HANDSHAKE_EVENT_REKEY_FAILED, HANDSHAKE_EVENT_EAP_NOTIFY, HANDSHAKE_EVENT_TRANSITION_DISABLE, + HANDSHAKE_EVENT_P2P_IP_REQUEST, }; typedef void (*handshake_event_func_t)(struct handshake_state *hs, diff --git a/src/station.c b/src/station.c @@ -753,6 +753,7 @@ static void station_handshake_event(struct handshake_state *hs, case HANDSHAKE_EVENT_COMPLETE: case HANDSHAKE_EVENT_SETTING_KEYS_FAILED: case HANDSHAKE_EVENT_EAP_NOTIFY: + case HANDSHAKE_EVENT_P2P_IP_REQUEST: /* * currently we don't care about any other events. The * netdev_connect_cb will notify us when the connection is