From f32f99df11ce2bde0039edc003098ee50bb588d4 Mon Sep 17 00:00:00 2001 From: Qiwei Cai Date: Wed, 5 Jan 2022 13:04:24 +0800 Subject: [PATCH] P2P: Send response frame on channel where the request is received The rx_freq of Public Action frame was not maintained by the GO and the GO always sent the response on the operating channel. This causes provision discovery failure when a P2P Device is sending a PD Request on a 2.4 GHz social channel and the GO is responding on a 5 GHz operating channel. Save the rx_freq and use it for GO to sent the response. This extends commit c5cc7a59acb2 ("Report offchannel RX frame frequency to hostapd") to cover additional frame types. Signed-off-by: Jouni Malinen --- src/ap/ieee802_11.c | 11 ++++------- wpa_supplicant/ap.c | 1 + 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/ap/ieee802_11.c b/src/ap/ieee802_11.c index db4104928..f63292537 100644 --- a/src/ap/ieee802_11.c +++ b/src/ap/ieee802_11.c @@ -6098,19 +6098,17 @@ static int handle_action(struct hostapd_data *hapd, end = ((const u8 *) mgmt) + len; gas_query_ap_rx(hapd->gas, mgmt->sa, mgmt->u.action.category, - pos, end - pos, hapd->iface->freq); + pos, end - pos, freq); return 1; } #endif /* CONFIG_DPP */ if (hapd->public_action_cb) { hapd->public_action_cb(hapd->public_action_cb_ctx, - (u8 *) mgmt, len, - hapd->iface->freq); + (u8 *) mgmt, len, freq); } if (hapd->public_action_cb2) { hapd->public_action_cb2(hapd->public_action_cb2_ctx, - (u8 *) mgmt, len, - hapd->iface->freq); + (u8 *) mgmt, len, freq); } if (hapd->public_action_cb || hapd->public_action_cb2) return 1; @@ -6118,8 +6116,7 @@ static int handle_action(struct hostapd_data *hapd, case WLAN_ACTION_VENDOR_SPECIFIC: if (hapd->vendor_action_cb) { if (hapd->vendor_action_cb(hapd->vendor_action_cb_ctx, - (u8 *) mgmt, len, - hapd->iface->freq) == 0) + (u8 *) mgmt, len, freq) == 0) return 1; } break; diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c index 37d39e674..ad2cf5f11 100644 --- a/wpa_supplicant/ap.c +++ b/wpa_supplicant/ap.c @@ -1203,6 +1203,7 @@ void ap_mgmt_rx(void *ctx, struct rx_mgmt *rx_mgmt) struct wpa_supplicant *wpa_s = ctx; struct hostapd_frame_info fi; os_memset(&fi, 0, sizeof(fi)); + fi.freq = rx_mgmt->freq; fi.datarate = rx_mgmt->datarate; fi.ssi_signal = rx_mgmt->ssi_signal; ieee802_11_mgmt(wpa_s->ap_iface->bss[0], rx_mgmt->frame, -- 2.47.3