Files
wlan-ap/feeds/ipq807x_v5.4/hostapd/patches/zzz-deny-6g-probe-resp.patch
John Crispin 33f8f22375 hostapd: add enhanced MPSK support
Signed-off-by: John Crispin <john@phrozen.org>
2024-07-11 12:17:15 +02:00

157 lines
5.5 KiB
Diff

--- a/src/ap/ieee802_11.c
+++ b/src/ap/ieee802_11.c
@@ -7740,7 +7740,7 @@ enum colocation_mode get_colocation_mode
}
-size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type)
+size_t _hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type, int add_6g)
{
size_t len = 0, current_len = 0;
enum colocation_mode mode = get_colocation_mode(hapd);
@@ -7753,7 +7753,7 @@ size_t hostapd_eid_rnr_len(struct hostap
/* fallthrough */
case WLAN_FC_STYPE_PROBE_RESP:
- if (mode == COLOCATED_LOWER_BAND)
+ if (add_6g && mode == COLOCATED_LOWER_BAND)
len += hostapd_eid_rnr_colocation_len(hapd,
&current_len);
@@ -7776,6 +7776,10 @@ size_t hostapd_eid_rnr_len(struct hostap
return len;
}
+size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type)
+{
+ return _hostapd_eid_rnr_len(hapd, type, 1);
+}
static u8 *hostapd_eid_rnr_iface(struct hostapd_data *hapd,
struct hostapd_data *reporting_hapd,
@@ -7938,7 +7942,7 @@ static u8 *hostapd_eid_neighbor_report_d
}
-u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type)
+u8 * _hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type, int add_6g)
{
u8 *eid_start = eid;
size_t current_len = 0;
@@ -7955,7 +7959,7 @@ u8 * hostapd_eid_rnr(struct hostapd_data
/* fallthrough */
case WLAN_FC_STYPE_PROBE_RESP:
- if (mode == COLOCATED_LOWER_BAND)
+ if (add_6g && mode == COLOCATED_LOWER_BAND)
eid = hostapd_eid_rnr_colocation(hapd, eid,
&current_len);
@@ -7981,4 +7985,9 @@ u8 * hostapd_eid_rnr(struct hostapd_data
return eid;
}
+u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type)
+{
+ return _hostapd_eid_rnr(hapd, eid, type, 1);
+}
+
#endif /* CONFIG_NATIVE_WINDOWS */
--- a/src/ap/ieee802_11.h
+++ b/src/ap/ieee802_11.h
@@ -135,6 +135,7 @@ u8 * hostapd_eid_time_zone(struct hostap
int hostapd_update_time_adv(struct hostapd_data *hapd);
void hostapd_client_poll_ok(struct hostapd_data *hapd, const u8 *addr);
u8 * hostapd_eid_bss_max_idle_period(struct hostapd_data *hapd, u8 *eid);
+u8 * _hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type, int add_6g);
u8 * hostapd_eid_rnr(struct hostapd_data *hapd, u8 *eid, u32 type);
u8 * hostapd_eid_multiple_bssid(struct hostapd_data *hapd,
struct hostapd_data *req_bss, u8 *eid, u8 *end,
@@ -146,6 +147,7 @@ size_t hostapd_eid_multiple_bssid_len(st
struct hostapd_data *req_bss, u32 type,
const u8 *known_bssids,
u8 known_bssids_len, size_t *rnr_len);
+size_t _hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type, int add_6g);
size_t hostapd_eid_rnr_len(struct hostapd_data *hapd, u32 type);
int auth_sae_init_committed(struct hostapd_data *hapd, struct sta_info *sta);
#ifdef CONFIG_SAE
--- a/src/ap/beacon.c
+++ b/src/ap/beacon.c
@@ -463,7 +463,8 @@ static u8 * hostapd_eid_supported_op_cla
static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
const struct ieee80211_mgmt *req,
int is_p2p, size_t *resp_len,
- const u8 *known_bssids, u8 known_bssids_len)
+ const u8 *known_bssids, u8 known_bssids_len,
+ int add_6g)
{
struct hostapd_data *req_bss = NULL;
struct ieee80211_mgmt *resp;
@@ -523,7 +524,7 @@ static u8 * hostapd_gen_probe_resp(struc
known_bssids,
known_bssids_len,
NULL);
- buflen += hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP);
+ buflen += _hostapd_eid_rnr_len(hapd, WLAN_FC_STYPE_PROBE_RESP, add_6g);
resp = os_zalloc(buflen);
if (resp == NULL)
@@ -706,7 +707,7 @@ static u8 * hostapd_gen_probe_resp(struc
pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos);
pos = hostapd_eid_owe_trans(hapd, pos, (u8 *) resp + buflen - pos);
pos = hostapd_eid_dpp_cc(hapd, pos, (u8 *) resp + buflen - pos);
- pos = hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP);
+ pos = _hostapd_eid_rnr(hapd, pos, WLAN_FC_STYPE_PROBE_RESP, add_6g);
if (hapd->conf->vendor_elements) {
os_memcpy(pos, wpabuf_head(hapd->conf->vendor_elements),
@@ -930,6 +931,7 @@ void handle_probe_req(struct hostapd_dat
.ssi_signal = ssi_signal,
.elems = &elems,
};
+ int ubus_response;
if (hapd->iconf->rssi_ignore_probe_request && ssi_signal &&
ssi_signal < hapd->iconf->rssi_ignore_probe_request)
@@ -1118,7 +1120,12 @@ void handle_probe_req(struct hostapd_dat
}
#endif /* CONFIG_P2P */
- if (hostapd_ubus_handle_event(hapd, &req)) {
+ ubus_response = hostapd_ubus_handle_event(hapd, &req);
+
+ if (ubus_response == 2) {
+ wpa_printf(MSG_DEBUG, "Probe request for " MACSTR " without 6G RNR.\n",
+ MAC2STR(mgmt->sa));
+ } else if (ubus_response) {
wpa_printf(MSG_DEBUG, "Probe request for " MACSTR " rejected by ubus handler.\n",
MAC2STR(mgmt->sa));
return;
@@ -1170,7 +1177,7 @@ void handle_probe_req(struct hostapd_dat
resp = hostapd_gen_probe_resp(hapd, mgmt, elems.p2p != NULL,
&resp_len, elems.known_bssids,
- elems.known_bssids_len);
+ elems.known_bssids_len, ubus_response == 2 ? 0 : 1);
if (resp == NULL)
return;
@@ -1239,7 +1246,7 @@ static u8 * hostapd_probe_resp_offloads(
"this");
/* Generate a Probe Response template for the non-P2P case */
- return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len, NULL, 0);
+ return hostapd_gen_probe_resp(hapd, NULL, 0, resp_len, NULL, 0, 1);
}
#endif /* NEED_AP_MLME */
@@ -1269,7 +1276,7 @@ static u8 * hostapd_unsol_bcast_probe_re
return hostapd_gen_probe_resp(hapd, NULL, 0,
&params->unsol_bcast_probe_resp_tmpl_len,
- NULL, 0);
+ NULL, 0, 1);
}
#endif /* CONFIG_IEEE80211AX */