[PATCH] wpa_supplicant/hostapd: add an option to only advertise FTM responder

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: Avraham Stern <avraham.stern@xxxxxxxxx>

When configuring FTM responder, wpa_supplicant/hostapd configures the
driver to operate as a responder. However, it is possible that it is
only needed to advertise the FTM responder capabilties, but not
configure the driver to operate as a responder (e.g. when a usespace
daemon operates as a responder). Add an option to only advertise the
FTM responder capabilities without configuring the driver.

Signed-off-by: Avraham Stern <avraham.stern@xxxxxxxxx>
Signed-off-by: Andrei Otcheretianski <andrei.otcheretianski@xxxxxxxxx>
---
 hostapd/config_file.c           |  2 ++
 src/ap/ap_config.h              |  1 +
 src/ap/ieee802_11_shared.c      |  3 ++-
 wpa_supplicant/ap.c             |  1 +
 wpa_supplicant/config.c         |  1 +
 wpa_supplicant/config.h         | 14 +++++++++++++-
 wpa_supplicant/config_file.c    |  3 +++
 wpa_supplicant/wpa_supplicant.c |  3 ++-
 8 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/hostapd/config_file.c b/hostapd/config_file.c
index b5393fd6c7..01454e1c6c 100644
--- a/hostapd/config_file.c
+++ b/hostapd/config_file.c
@@ -4427,6 +4427,8 @@ static int hostapd_config_fill(struct hostapd_config *conf,
 		conf->stationary_ap = atoi(pos);
 	} else if (os_strcmp(buf, "ftm_responder") == 0) {
 		bss->ftm_responder = atoi(pos);
+	} else if (os_strcmp(buf, "ftm_responder_capab_only") == 0) {
+		bss->ftm_responder_capab_only = atoi(pos);
 	} else if (os_strcmp(buf, "ftm_initiator") == 0) {
 		bss->ftm_initiator = atoi(pos);
 #ifdef CONFIG_FILS
diff --git a/src/ap/ap_config.h b/src/ap/ap_config.h
index 46b7a47816..456387d9b5 100644
--- a/src/ap/ap_config.h
+++ b/src/ap/ap_config.h
@@ -731,6 +731,7 @@ struct hostapd_bss_config {
 #endif /* CONFIG_MBO */
 
 	int ftm_responder;
+	int ftm_responder_capab_only;
 	int ftm_initiator;
 
 #ifdef CONFIG_FILS
diff --git a/src/ap/ieee802_11_shared.c b/src/ap/ieee802_11_shared.c
index a7ab3a2d77..c94f0d942e 100644
--- a/src/ap/ieee802_11_shared.c
+++ b/src/ap/ieee802_11_shared.c
@@ -404,7 +404,8 @@ static void hostapd_ext_capab_byte(struct hostapd_data *hapd, u8 *pos, int idx,
 	case 7: /* Bits 56-63 */
 		break;
 	case 8: /* Bits 64-71 */
-		if (hapd->conf->ftm_responder)
+		if (hapd->conf->ftm_responder ||
+		    hapd->conf->ftm_responder_capab_only)
 			*pos |= 0x40; /* Bit 70 - FTM responder */
 		if (hapd->conf->ftm_initiator)
 			*pos |= 0x80; /* Bit 71 - FTM initiator */
diff --git a/wpa_supplicant/ap.c b/wpa_supplicant/ap.c
index 653f15f54d..6a96550a19 100644
--- a/wpa_supplicant/ap.c
+++ b/wpa_supplicant/ap.c
@@ -785,6 +785,7 @@ no_wps:
 	}
 
 	bss->ftm_responder = wpa_s->conf->ftm_responder;
+	bss->ftm_responder_capab_only = wpa_s->conf->ftm_responder_capab_only;
 	bss->ftm_initiator = wpa_s->conf->ftm_initiator;
 
 	bss->transition_disable = ssid->transition_disable;
diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index a2e21431c2..4b228c1a0d 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -5461,6 +5461,7 @@ static const struct global_parse_data global_fields[] = {
 #endif /* CONFIG_MBO */
 	{ INT(gas_address3), 0 },
 	{ INT_RANGE(ftm_responder, 0, 1), 0 },
+	{ INT_RANGE(ftm_responder_capab_only, 0, 1), 0 },
 	{ INT_RANGE(ftm_initiator, 0, 1), 0 },
 	{ INT(gas_rand_addr_lifetime), 0 },
 	{ INT_RANGE(gas_rand_mac_addr, 0, 2), 0 },
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 87cbb1ea2f..01dfad051c 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -1586,17 +1586,29 @@ struct wpa_config {
 
 	/**
 	 * ftm_responder - Publish FTM (fine timing measurement)
-	 * responder functionality
+	 * responder functionality and configure the driver as a FTM responder
 	 *
 	 * Values:
 	 * 0 - do not publish FTM responder functionality (Default)
 	 * 1 - publish FTM responder functionality in
 	 *	bit 70 of Extended Capabilities element
+	 *	and configure the driver as a FTM responder
 	 * Note, actual FTM responder operation is managed outside
 	 * wpa_supplicant.
 	 */
 	int ftm_responder;
 
+	/**
+	 * ftm_responder_capab_only - Publish FTM (fine timing measurement)
+	 * responder functionality but don't configure the driver as a responder
+	 *
+	 * Values:
+	 * 0 - do not publish FTM responder functionality (Default)
+	 * 1 - publish FTM responder functionality in
+	 *	bit 70 of Extended Capabilities element
+	 */
+	int ftm_responder_capab_only;
+
 	/**
 	 * ftm_initiator - Publish FTM (fine timing measurement)
 	 * initiator functionality
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 4d50f44a86..af9c391e84 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -1550,6 +1550,9 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
 
 	if (config->ftm_responder)
 		fprintf(f, "ftm_responder=%d\n", config->ftm_responder);
+	if (config->ftm_responder_capab_only)
+		fprintf(f, "ftm_responder_capab_only=%d\n",
+			config->ftm_responder_capab_only);
 	if (config->ftm_initiator)
 		fprintf(f, "ftm_initiator=%d\n", config->ftm_initiator);
 
diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c
index 7849b40296..35be751154 100644
--- a/wpa_supplicant/wpa_supplicant.c
+++ b/wpa_supplicant/wpa_supplicant.c
@@ -2110,7 +2110,8 @@ static void wpas_ext_capab_byte(struct wpa_supplicant *wpa_s, u8 *pos, int idx)
 	case 7: /* Bits 56-63 */
 		break;
 	case 8: /* Bits 64-71 */
-		if (wpa_s->conf->ftm_responder)
+		if (wpa_s->conf->ftm_responder ||
+		    wpa_s->conf->ftm_responder_capab_only)
 			*pos |= 0x40; /* Bit 70 - FTM responder */
 		if (wpa_s->conf->ftm_initiator)
 			*pos |= 0x80; /* Bit 71 - FTM initiator */
-- 
2.25.1


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux