From: Shreedhar Parande Date: Thu, 10 Apr 2025 15:59:41 +0000 (+0530) Subject: AP: Advertise the LCI and civic location capabilities X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=4b8ac10cb77c3d4dbf7ccefbe697dc0578da374c;p=thirdparty%2Fhostap.git AP: Advertise the LCI and civic location capabilities Currently, for Fine Time Measurement (FTM), hostapd configures Location Configuration Information (LCI) and civic location values without advertising capabilities in the Extended Capabilities and RM Enabled Capabilities elements. According to IEEE Std 802.11-2024, 11.21.6.7 (LCI and Location Civic retrieval using FTM procedure), to use LCI and Civic subelements in FTM frames, the AP must advertise these capabilities. Advertise LCI and civic measurement capabilities in the Extended Capabilities and RM Enabled Capabilities elements when these values are available. Signed-off-by: Shreedhar Parande --- diff --git a/hostapd/config_file.c b/hostapd/config_file.c index 0e35730f9..e37579efc 100644 --- a/hostapd/config_file.c +++ b/hostapd/config_file.c @@ -4485,6 +4485,15 @@ static int hostapd_config_fill(struct hostapd_config *conf, wpabuf_free(conf->lci); conf->lci = NULL; } + if (conf->lci) { + /* Enable LCI capability in RM Enabled Capabilities + * element */ + bss->radio_measurements[1] |= + WLAN_RRM_CAPS_LCI_MEASUREMENT; + } else { + bss->radio_measurements[1] &= + ~WLAN_RRM_CAPS_LCI_MEASUREMENT; + } } else if (os_strcmp(buf, "civic") == 0) { wpabuf_free(conf->civic); conf->civic = wpabuf_parse_bin(pos); @@ -4492,6 +4501,15 @@ static int hostapd_config_fill(struct hostapd_config *conf, wpabuf_free(conf->civic); conf->civic = NULL; } + if (conf->civic) { + /* Enable civic location capability in RM Enabled + * Capabilities element */ + bss->radio_measurements[4] |= + WLAN_RRM_CAPS_CIVIC_LOCATION_MEASUREMENT; + } else { + bss->radio_measurements[4] &= + ~WLAN_RRM_CAPS_CIVIC_LOCATION_MEASUREMENT; + } } else if (os_strcmp(buf, "rrm_neighbor_report") == 0) { if (atoi(pos)) bss->radio_measurements[0] |= diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c index 986b7b81e..e873e1c12 100644 --- a/src/ap/ieee802_11_shared.c +++ b/src/ap/ieee802_11_shared.c @@ -381,6 +381,10 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx, /* Bit 13 - Collocated Interference Reporting */ *pos |= 0x20; } + if (hapd->iface->conf->civic) + *pos |= 0x40; /* Bit 14 - Civic Location */ + if (hapd->iface->conf->lci) + *pos |= 0x80; /* Bit 15 - Geospatial Location */ break; case 2: /* Bits 16-23 */ if (hapd->conf->wnm_sleep_mode) diff --git a/src/common/ieee802_11_defs.h b/src/common/ieee802_11_defs.h index 8ded386e5..d029cf905 100644 --- a/src/common/ieee802_11_defs.h +++ b/src/common/ieee802_11_defs.h @@ -808,6 +808,7 @@ #define WLAN_RRM_CAPS_LCI_MEASUREMENT BIT(4) /* byte 5 (out of 5) */ #define WLAN_RRM_CAPS_FTM_RANGE_REPORT BIT(2) +#define WLAN_RRM_CAPS_CIVIC_LOCATION_MEASUREMENT BIT(3) /* * IEEE Std 802.11-2020, 9.4.2.20.19 (Fine Timing Measurement Range