]> git.ipfire.org Git - thirdparty/hostap.git/blobdiff - src/ap/beacon.c
HE: Send the AP's OBSS PD settings to the kernel
[thirdparty/hostap.git] / src / ap / beacon.c
index 1838c1c843093600df68e11548de9c00513e3160..6c94f9521942cad39324832150b3bc7fb7a87137 100644 (file)
@@ -456,7 +456,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
        pos = hostapd_eid_ext_supp_rates(hapd, pos);
 
        /* RSN, MDIE */
-       if (hapd->conf->wpa != WPA_PROTO_WPA)
+       if (!(hapd->conf->wpa == WPA_PROTO_WPA ||
+             (hapd->conf->osen && !hapd->conf->wpa)))
                pos = hostapd_eid_wpa(hapd, pos, epos - pos);
 
        pos = hostapd_eid_bss_load(hapd, pos, epos - pos);
@@ -510,7 +511,7 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 
 #ifdef CONFIG_IEEE80211AX
        if (hapd->iconf->ieee80211ax) {
-               pos = hostapd_eid_he_capab(hapd, pos);
+               pos = hostapd_eid_he_capab(hapd, pos, IEEE80211_MODE_AP);
                pos = hostapd_eid_he_operation(hapd, pos);
                pos = hostapd_eid_he_mu_edca_parameter_set(hapd, pos);
                pos = hostapd_eid_spatial_reuse(hapd, pos);
@@ -523,7 +524,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 #endif /* CONFIG_IEEE80211AC */
 
        /* WPA */
-       if (hapd->conf->wpa == WPA_PROTO_WPA)
+       if (hapd->conf->wpa == WPA_PROTO_WPA ||
+           (hapd->conf->osen && !hapd->conf->wpa))
                pos = hostapd_eid_wpa(hapd, pos, epos - pos);
 
        /* Wi-Fi Alliance WMM */
@@ -553,7 +555,6 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 
 #ifdef CONFIG_HS20
        pos = hostapd_eid_hs20_indication(hapd, pos);
-       pos = hostapd_eid_osen(hapd, pos);
 #endif /* CONFIG_HS20 */
 
        pos = hostapd_eid_mbo(hapd, pos, (u8 *) resp + buflen - pos);
@@ -1164,7 +1165,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
        tailpos = hostapd_eid_ext_supp_rates(hapd, tailpos);
 
        /* RSN, MDIE */
-       if (hapd->conf->wpa != WPA_PROTO_WPA)
+       if (!(hapd->conf->wpa == WPA_PROTO_WPA ||
+             (hapd->conf->osen && !hapd->conf->wpa)))
                tailpos = hostapd_eid_wpa(hapd, tailpos,
                                          tail + BEACON_TAIL_BUF_SIZE -
                                          tailpos);
@@ -1226,7 +1228,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 
 #ifdef CONFIG_IEEE80211AX
        if (hapd->iconf->ieee80211ax) {
-               tailpos = hostapd_eid_he_capab(hapd, tailpos);
+               tailpos = hostapd_eid_he_capab(hapd, tailpos,
+                                              IEEE80211_MODE_AP);
                tailpos = hostapd_eid_he_operation(hapd, tailpos);
                tailpos = hostapd_eid_he_mu_edca_parameter_set(hapd, tailpos);
                tailpos = hostapd_eid_spatial_reuse(hapd, tailpos);
@@ -1239,7 +1242,8 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 #endif /* CONFIG_IEEE80211AC */
 
        /* WPA */
-       if (hapd->conf->wpa == WPA_PROTO_WPA)
+       if (hapd->conf->wpa == WPA_PROTO_WPA ||
+           (hapd->conf->osen && !hapd->conf->wpa))
                tailpos = hostapd_eid_wpa(hapd, tailpos,
                                          tail + BEACON_TAIL_BUF_SIZE -
                                          tailpos);
@@ -1270,7 +1274,6 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
 
 #ifdef CONFIG_HS20
        tailpos = hostapd_eid_hs20_indication(hapd, tailpos);
-       tailpos = hostapd_eid_osen(hapd, tailpos);
 #endif /* CONFIG_HS20 */
 
        tailpos = hostapd_eid_mbo(hapd, tailpos, tail + tail_len - tailpos);
@@ -1398,6 +1401,7 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
        struct hostapd_freq_params freq;
        struct hostapd_iface *iface = hapd->iface;
        struct hostapd_config *iconf = iface->conf;
+       struct hostapd_hw_modes *cmode = iface->current_mode;
        struct wpabuf *beacon, *proberesp, *assocresp;
        int res, ret = -1;
 
@@ -1419,9 +1423,16 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
        params.proberesp_ies = proberesp;
        params.assocresp_ies = assocresp;
        params.reenable = hapd->reenable_beacon;
+#ifdef CONFIG_IEEE80211AX
+       params.he_spr = !!hapd->iface->conf->spr.sr_control;
+       params.he_spr_srg_obss_pd_min_offset =
+               hapd->iface->conf->spr.srg_obss_pd_min_offset;
+       params.he_spr_srg_obss_pd_max_offset =
+               hapd->iface->conf->spr.srg_obss_pd_max_offset;
+#endif /* CONFIG_IEEE80211AX */
        hapd->reenable_beacon = 0;
 
-       if (iface->current_mode &&
+       if (cmode &&
            hostapd_set_freq_params(&freq, iconf->hw_mode, iface->freq,
                                    iconf->channel, iconf->ieee80211n,
                                    iconf->ieee80211ac, iconf->ieee80211ax,
@@ -1429,8 +1440,8 @@ int ieee802_11_set_beacon(struct hostapd_data *hapd)
                                    hostapd_get_oper_chwidth(iconf),
                                    hostapd_get_oper_centr_freq_seg0_idx(iconf),
                                    hostapd_get_oper_centr_freq_seg1_idx(iconf),
-                                   iface->current_mode->vht_capab,
-                                   &iface->current_mode->he_capab) == 0)
+                                   cmode->vht_capab,
+                                   &cmode->he_capab[IEEE80211_MODE_AP]) == 0)
                params.freq = &freq;
 
        res = hostapd_drv_set_ap(hapd, &params);