developer | f32dabf | 2022-06-01 10:59:24 +0800 | [diff] [blame] | 1 | From 96a7f383290f78e15f1e7a5bc33099c81f104c5b Mon Sep 17 00:00:00 2001 |
| 2 | From: MeiChia Chiu <meichia.chiu@mediatek.com> |
| 3 | Date: Fri, 6 May 2022 11:02:36 +0800 |
| 4 | Subject: hostapd: Add the destination address of unsolicited Probe Response |
| 5 | frame |
| 6 | |
| 7 | Without this, hostapd generates Probe Response frames with the null |
| 8 | destination address when hostapd enables unsolicited Probe Response |
| 9 | frame transmission. Fix this to use the broadcast address instead. |
| 10 | |
| 11 | Fixes: 024b4b2a298f ("AP: Unsolicited broadcast Probe Response configuration") |
| 12 | Signed-off-by: MeiChia Chiu <meichia.chiu@mediatek.com> |
| 13 | --- |
| 14 | src/ap/beacon.c | 13 +++++++++---- |
| 15 | 1 file changed, 9 insertions(+), 4 deletions(-) |
| 16 | |
| 17 | diff --git a/src/ap/beacon.c b/src/ap/beacon.c |
| 18 | index eaa403326..58872bfda 100644 |
| 19 | --- a/src/ap/beacon.c |
| 20 | +++ b/src/ap/beacon.c |
| 21 | @@ -464,7 +464,8 @@ static u8 * hostapd_eid_supported_op_classes(struct hostapd_data *hapd, u8 *eid) |
| 22 | |
| 23 | static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, |
| 24 | const struct ieee80211_mgmt *req, |
| 25 | - int is_p2p, size_t *resp_len) |
| 26 | + int is_p2p, size_t *resp_len, |
| 27 | + bool bcast_probe_resp) |
| 28 | { |
| 29 | struct ieee80211_mgmt *resp; |
| 30 | u8 *pos, *epos, *csa_pos; |
| 31 | @@ -531,6 +532,9 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd, |
| 32 | WLAN_FC_STYPE_PROBE_RESP); |
| 33 | if (req) |
| 34 | os_memcpy(resp->da, req->sa, ETH_ALEN); |
| 35 | + else if (bcast_probe_resp) |
| 36 | + os_memset(resp->da, 0xff, ETH_ALEN); |
| 37 | + |
| 38 | os_memcpy(resp->sa, hapd->own_addr, ETH_ALEN); |
| 39 | |
| 40 | os_memcpy(resp->bssid, hapd->own_addr, ETH_ALEN); |
| 41 | @@ -1141,7 +1145,7 @@ void handle_probe_req(struct hostapd_data *hapd, |
| 42 | " signal=%d", MAC2STR(mgmt->sa), ssi_signal); |
| 43 | |
| 44 | resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL, |
| 45 | - &resp_len); |
| 46 | + &resp_len, false); |
| 47 | if (resp == NULL) |
| 48 | return; |
| 49 | |
| 50 | @@ -1210,7 +1214,7 @@ static u8 * hostapd_probe_resp_offloads(struct hostapd_data *hapd, |
| 51 | "this"); |
| 52 | |
| 53 | /* Generate a Probe Response template for the non-P2P case */ |
| 54 | - return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len); |
| 55 | + return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len, false); |
| 56 | } |
| 57 | |
| 58 | #endif /* NEED_AP_MLME */ |
| 59 | @@ -1228,7 +1232,8 @@ static u8 * hostapd_unsol_bcast_probe_resp(struct hostapd_data *hapd, |
| 60 | hapd->conf->unsol_bcast_probe_resp_interval; |
| 61 | |
| 62 | return hostapd_gen_probe_resp(hapd, NULL, 0, |
| 63 | - ¶ms->unsol_bcast_probe_resp_tmpl_len); |
| 64 | + ¶ms->unsol_bcast_probe_resp_tmpl_len, |
| 65 | + true); |
| 66 | } |
| 67 | #endif /* CONFIG_IEEE80211AX */ |
| 68 | |
| 69 | -- |
| 70 | cgit v1.2.3-18-g5258 |
| 71 | |