3
0
mirror of https://git.kernel.org/pub/scm/network/wireless/iwd.git synced 2024-11-20 04:19:25 +01:00

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.
This commit is contained in:
Andrew Zaborowski 2021-08-23 16:14:22 +02:00 committed by Denis Kenzior
parent ed10b00afa
commit a90c4025f1
3 changed files with 19 additions and 0 deletions

View File

@ -1350,6 +1350,23 @@ static void eapol_send_ptk_3_of_4(struct eapol_sm *sm)
key_data_len += gtk_kde[1] + 2; 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) { if (sm->handshake->support_ip_allocation) {
/* Wi-Fi P2P Technical Specification v1.7 Table 59 */ /* Wi-Fi P2P Technical Specification v1.7 Table 59 */
key_data_buf[key_data_len++] = IE_TYPE_VENDOR_SPECIFIC; key_data_buf[key_data_len++] = IE_TYPE_VENDOR_SPECIFIC;

View File

@ -57,6 +57,7 @@ enum handshake_event {
HANDSHAKE_EVENT_REKEY_FAILED, HANDSHAKE_EVENT_REKEY_FAILED,
HANDSHAKE_EVENT_EAP_NOTIFY, HANDSHAKE_EVENT_EAP_NOTIFY,
HANDSHAKE_EVENT_TRANSITION_DISABLE, HANDSHAKE_EVENT_TRANSITION_DISABLE,
HANDSHAKE_EVENT_P2P_IP_REQUEST,
}; };
typedef void (*handshake_event_func_t)(struct handshake_state *hs, typedef void (*handshake_event_func_t)(struct handshake_state *hs,

View File

@ -753,6 +753,7 @@ static void station_handshake_event(struct handshake_state *hs,
case HANDSHAKE_EVENT_COMPLETE: case HANDSHAKE_EVENT_COMPLETE:
case HANDSHAKE_EVENT_SETTING_KEYS_FAILED: case HANDSHAKE_EVENT_SETTING_KEYS_FAILED:
case HANDSHAKE_EVENT_EAP_NOTIFY: case HANDSHAKE_EVENT_EAP_NOTIFY:
case HANDSHAKE_EVENT_P2P_IP_REQUEST:
/* /*
* currently we don't care about any other events. The * currently we don't care about any other events. The
* netdev_connect_cb will notify us when the connection is * netdev_connect_cb will notify us when the connection is