wpa_supplicant: Allow FTM functionality to be published
authorLior David <qca_liord@qca.qualcomm.com>
Wed, 3 Aug 2016 14:53:21 +0000 (17:53 +0300)
committerJouni Malinen <j@w1.fi>
Mon, 5 Sep 2016 18:27:23 +0000 (21:27 +0300)
Add configuration options that control publishing of fine timing
measurement (FTM) responder and initiator functionality via bits 70, 71
of Extended Capabilities element. Typically, FTM functionality is
controlled by a location framework outside wpa_supplicant. When
framework is activated, it will use wpa_supplicant to configure the
STA/AP to publish the FTM functionality. See IEEE P802.11-REVmc/D7.0,
9.4.2.27.

Signed-off-by: Lior David <qca_liord@qca.qualcomm.com>
wpa_supplicant/ap.c
wpa_supplicant/config.c
wpa_supplicant/config.h
wpa_supplicant/config_file.c
wpa_supplicant/wpa_supplicant.c
wpa_supplicant/wpa_supplicant.conf

index 7710a8d..356784a 100644 (file)
@@ -468,6 +468,9 @@ no_wps:
                        wpabuf_dup(wpa_s->conf->ap_vendor_elements);
        }
 
+       bss->ftm_responder = wpa_s->conf->ftm_responder;
+       bss->ftm_initiator = wpa_s->conf->ftm_initiator;
+
        return 0;
 }
 
index 3f69936..dd922ca 100644 (file)
@@ -4369,6 +4369,8 @@ static const struct global_parse_data global_fields[] = {
                    MBO_CELL_CAPA_NOT_SUPPORTED), 0 },
 #endif /*CONFIG_MBO */
        { INT(gas_address3), 0 },
+       { INT_RANGE(ftm_responder, 0, 1), 0 },
+       { INT_RANGE(ftm_initiator, 0, 1), 0 },
 };
 
 #undef FUNC
index 1535738..48e64be 100644 (file)
@@ -1302,6 +1302,32 @@ struct wpa_config {
         *      sent to not-associated AP; if associated, AP BSSID)
         */
        int gas_address3;
+
+       /**
+        * ftm_responder - Publish FTM (fine timing measurement)
+        * responder functionality
+        *
+        * Values:
+        * 0 - do not publish FTM responder functionality (Default)
+        * 1 - publish FTM responder functionality in
+        *      bit 70 of Extended Capabilities element
+        * Note, actual FTM responder operation is managed outside
+        * wpa_supplicant.
+        */
+       int ftm_responder;
+
+       /**
+        * ftm_initiator - Publish FTM (fine timing measurement)
+        * initiator functionality
+        *
+        * Values:
+        * 0 - do not publish FTM initiator functionality (Default)
+        * 1 - publish FTM initiator functionality in
+        *      bit 71 of Extended Capabilities element
+        * Note, actual FTM initiator operation is managed outside
+        * wpa_supplicant.
+        */
+       int ftm_initiator;
 };
 
 
index 994d5ea..7ae1654 100644 (file)
@@ -1339,6 +1339,11 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
 
        if (config->gas_address3)
                fprintf(f, "gas_address3=%d\n", config->gas_address3);
+
+       if (config->ftm_responder)
+               fprintf(f, "ftm_responder=%d\n", config->ftm_responder);
+       if (config->ftm_initiator)
+               fprintf(f, "ftm_initiator=%d\n", config->ftm_initiator);
 }
 
 #endif /* CONFIG_NO_CONFIG_WRITE */
index 5bb1f72..0785576 100644 (file)
@@ -1456,6 +1456,14 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx)
                break;
        case 6: /* Bits 48-55 */
                break;
+       case 7: /* Bits 56-63 */
+               break;
+       case 8: /* Bits 64-71 */
+               if (wpa_s->conf->ftm_responder)
+                       *pos |= 0x40; /* Bit 70 - FTM responder */
+               if (wpa_s->conf->ftm_initiator)
+                       *pos |= 0x80; /* Bit 71 - FTM initiator */
+               break;
        }
 }
 
@@ -1465,6 +1473,9 @@ int wpas_build_ext_capab(struct wpa_supplicant *wpa_s, u8 *buf, size_t buflen)
        u8 *pos = buf;
        u8 len = 6, i;
 
+       if (len < 9 &&
+           (wpa_s->conf->ftm_initiator || wpa_s->conf->ftm_responder))
+               len = 9;
        if (len < wpa_s->extended_capa_len)
                len = wpa_s->extended_capa_len;
        if (buflen < (size_t) len + 2) {
index 6ece942..c3d5272 100644 (file)
@@ -449,6 +449,22 @@ fast_reauth=1
 #     sent to not-associated AP; if associated, AP BSSID)
 #gas_address3=0
 
+# Publish fine timing measurement (FTM) responder functionality in
+# the Extended Capabilities element bit 70.
+# Controls whether FTM responder functionality will be published by AP/STA.
+# Note that actual FTM responder operation is managed outside wpa_supplicant.
+# 0 = Do not publish; default
+# 1 = Publish
+#ftm_responder=0
+
+# Publish fine timing measurement (FTM) initiator functionality in
+# the Extended Capabilities element bit 71.
+# Controls whether FTM initiator functionality will be published by AP/STA.
+# Note that actual FTM initiator operation is managed outside wpa_supplicant.
+# 0 = Do not publish; default
+# 1 = Publish
+#ftm_initiator=0
+
 # credential block
 #
 # Each credential used for automatic network selection is configured as a set