]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
RRM: Add AP mode minimal advertisement support for testing
authorJouni Malinen <j@w1.fi>
Fri, 12 Dec 2014 18:45:31 +0000 (20:45 +0200)
committerJouni Malinen <j@w1.fi>
Fri, 12 Dec 2014 18:45:31 +0000 (20:45 +0200)
The new hostapd.conf radio_measurements parameter can now be used to
configure a test build to advertise support for radio measurements with
neighbor report enabled. There is no real functionality that would
actually process the request, i.e., this only for the purpose of minimal
STA side testing for now.

Signed-off-by: Jouni Malinen <j@w1.fi>
hostapd/config_file.c
src/ap/ap_config.h
src/ap/beacon.c
src/ap/ieee802_11.c

index c9ff3ec519b2cb49035b88db4469f235cdb0c5f1..e30efbe31060e599297303c906f20844896753f8 100644 (file)
@@ -3129,6 +3129,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
                pos++;
                WPA_PUT_LE16(&bss->bss_load_test[3], atoi(pos));
                bss->bss_load_test_set = 1;
+       } else if (os_strcmp(buf, "radio_measurements") == 0) {
+               bss->radio_measurements = atoi(pos);
 #endif /* CONFIG_TESTING_OPTIONS */
        } else if (os_strcmp(buf, "vendor_elements") == 0) {
                struct wpabuf *elems;
index 64df60d3480a0d561e6cd1acc1fd8356af9acaa2..58af6cb19f57997c817f2bf89824f182349d6059 100644 (file)
@@ -549,6 +549,8 @@ struct hostapd_bss_config {
 
 #define MESH_ENABLED BIT(0)
        int mesh;
+
+       int radio_measurements;
 };
 
 
index f73f83af2f2103c63b3fcf93be30bcd251e8d244..4a8703accec39f8f33cfbaa3d287e54fc4594057 100644 (file)
 
 #ifdef NEED_AP_MLME
 
+static u8 * hostapd_eid_rm_enabled_capab(struct hostapd_data *hapd, u8 *eid,
+                                        size_t len)
+{
+       if (!hapd->conf->radio_measurements || len < 2 + 4)
+               return eid;
+
+       *eid++ = WLAN_EID_RRM_ENABLED_CAPABILITIES;
+       *eid++ = 5;
+       *eid++ = (hapd->conf->radio_measurements & BIT(0)) ?
+               WLAN_RRM_CAPS_NEIGHBOR_REPORT : 0x00;
+       *eid++ = 0x00;
+       *eid++ = 0x00;
+       *eid++ = 0x00;
+       *eid++ = 0x00;
+       return eid;
+}
+
+
 static u8 * hostapd_eid_bss_load(struct hostapd_data *hapd, u8 *eid, size_t len)
 {
        if (len < 2 + 5)
@@ -409,6 +427,8 @@ static u8 * hostapd_gen_probe_resp(struct hostapd_data *hapd,
 
        pos = hostapd_eid_bss_load(hapd, pos, epos - pos);
 
+       pos = hostapd_eid_rm_enabled_capab(hapd, pos, epos - pos);
+
 #ifdef CONFIG_IEEE80211N
        pos = hostapd_eid_ht_capabilities(hapd, pos);
        pos = hostapd_eid_ht_operation(hapd, pos);
@@ -819,6 +839,10 @@ int ieee802_11_build_ap_params(struct hostapd_data *hapd,
        tailpos = hostapd_eid_wpa(hapd, tailpos, tail + BEACON_TAIL_BUF_SIZE -
                                  tailpos);
 
+       tailpos = hostapd_eid_rm_enabled_capab(hapd, tailpos,
+                                              tail + BEACON_TAIL_BUF_SIZE -
+                                              tailpos);
+
        tailpos = hostapd_eid_bss_load(hapd, tailpos,
                                       tail + BEACON_TAIL_BUF_SIZE - tailpos);
 
index 1dbd996cd575603eed3110c787fd24bcdf0800ce..8a51b33be7d66b6446abdb615fbd87524353bdf7 100644 (file)
@@ -199,6 +199,9 @@ u16 hostapd_own_capab_info(struct hostapd_data *hapd, struct sta_info *sta,
            (hapd->iconf->spectrum_mgmt_required || dfs))
                capab |= WLAN_CAPABILITY_SPECTRUM_MGMT;
 
+       if (hapd->conf->radio_measurements)
+               capab |= IEEE80211_CAP_RRM;
+
        return capab;
 }