[PATCH 08/25] MBO: Add cellular capability to MBO IE

Ilan Peer ilan.peer at intel.com
Mon Feb 15 06:53:28 PST 2016


From: David Spinadel <david.spinadel at intel.com>

- Add cellular capability attribute to MBO IE.
- Add MBO IE with cellular capabilities to probe requests.

By default, cellular capability value is set to not supported.

Signed-off-by: David Spinadel <david.spinadel at intel.com>
---
 wpa_supplicant/config.c           |  6 ++++++
 wpa_supplicant/config.h           |  6 ++++++
 wpa_supplicant/config_file.c      |  2 ++
 wpa_supplicant/mbo.c              | 25 +++++++++++++++++++++----
 wpa_supplicant/scan.c             |  6 ++++++
 wpa_supplicant/wpa_supplicant_i.h |  1 +
 6 files changed, 42 insertions(+), 4 deletions(-)

diff --git a/wpa_supplicant/config.c b/wpa_supplicant/config.c
index c14dd91..d1dc220 100644
--- a/wpa_supplicant/config.c
+++ b/wpa_supplicant/config.c
@@ -3561,6 +3561,10 @@ struct wpa_config * wpa_config_alloc_empty(const char *ctrl_interface,
 	config->cert_in_cb = DEFAULT_CERT_IN_CB;
 	config->wpa_rsc_relaxation = DEFAULT_WPA_RSC_RELAXATION;
 
+#ifdef CONFIG_MBO
+	config->mbo_cell_capa = DEFAULT_MBO_CELL_CAPA;
+#endif /* CONFIG_MBO */
+
 	if (ctrl_interface)
 		config->ctrl_interface = os_strdup(ctrl_interface);
 	if (driver_param)
@@ -4270,6 +4274,8 @@ static const struct global_parse_data global_fields[] = {
 	{ STR(sched_scan_plans), CFG_CHANGED_SCHED_SCAN_PLANS },
 #ifdef CONFIG_MBO
 	{ STR(np_chan), 0 },
+	{ INT_RANGE(mbo_cell_capa, MBO_CELL_CAPA_AVAILABLE,
+		    MBO_CELL_CAPA_NOT_SUPPORTED), 0 },
 #endif /*CONFIG_MBO */
 };
 
diff --git a/wpa_supplicant/config.h b/wpa_supplicant/config.h
index 8afa37b..5b4f2a2 100644
--- a/wpa_supplicant/config.h
+++ b/wpa_supplicant/config.h
@@ -1284,6 +1284,12 @@ struct wpa_config {
 	 * Detail is optional.
 	 */
 	char *np_chan;
+
+	/**
+	 * mbo_cell_capa - cellular capabilities for mbo
+	 */
+#define DEFAULT_MBO_CELL_CAPA MBO_CELL_CAPA_NOT_SUPPORTED
+	 u8 mbo_cell_capa;
 #endif /* CONFIG_MBO */
 
 };
diff --git a/wpa_supplicant/config_file.c b/wpa_supplicant/config_file.c
index 8a0045a..1e43279 100644
--- a/wpa_supplicant/config_file.c
+++ b/wpa_supplicant/config_file.c
@@ -1331,6 +1331,8 @@ static void wpa_config_write_global(FILE *f, struct wpa_config *config)
 #ifdef CONFIG_MBO
 	if (config->np_chan)
 		fprintf(f, "np_chan=%s\n", config->np_chan);
+	if (config->mbo_cell_capa != DEFAULT_MBO_CELL_CAPA)
+		fprintf(f, "mbo_cell_capa=%u\n", config->mbo_cell_capa);
 #endif /* CONFIG_MBO */
 
 }
diff --git a/wpa_supplicant/mbo.c b/wpa_supplicant/mbo.c
index 1cfea44..10954e8 100644
--- a/wpa_supplicant/mbo.c
+++ b/wpa_supplicant/mbo.c
@@ -162,10 +162,7 @@ int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len)
 	struct wpabuf *mbo;
 	int res;
 
-	if (!wpa_s->np_chan || !wpa_s->np_chan_num)
-		return 0;
-
-	if (len < MBO_IE_HEADER + 7)
+	if (len < MBO_IE_HEADER + 3 + 7)
 		return 0;
 
 	/* Leave room for the MBO IE header */
@@ -176,6 +173,13 @@ int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len)
 	/* Add Non-preferred channels attribute */
 	wpas_mbo_np_chan_attrs(wpa_s, mbo, 0);
 
+	/* Send cellular capabilityes attribute even if AP doesn't advertise
+	 * cellular capabilities
+	 */
+	wpabuf_put_u8(mbo, MBO_ATTR_ID_CELL_CAPA);
+	wpabuf_put_u8(mbo, 1);
+	wpabuf_put_u8(mbo, wpa_s->conf->mbo_cell_capa);
+
 	res = mbo_add_ie(buf, len, wpabuf_head_u8(mbo), wpabuf_len(mbo));
 	if (!res)
 		wpa_printf(MSG_ERROR, "Failed to add MBO IE");
@@ -338,3 +342,16 @@ free:
 	os_free(cmd);
 	return -1;
 }
+
+
+void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie)
+{
+	wpabuf_put_u8(ie, WLAN_EID_VENDOR_SPECIFIC);
+	wpabuf_put_u8(ie, 7);
+	wpabuf_put_be24(ie, OUI_WFA);
+	wpabuf_put_u8(ie, MBO_OUI_TYPE);
+
+	wpabuf_put_u8(ie, MBO_ATTR_ID_CELL_CAPA);
+	wpabuf_put_u8(ie, 1);
+	wpabuf_put_u8(ie, wpa_s->conf->mbo_cell_capa);
+}
diff --git a/wpa_supplicant/scan.c b/wpa_supplicant/scan.c
index 30bec2c..c333e57 100644
--- a/wpa_supplicant/scan.c
+++ b/wpa_supplicant/scan.c
@@ -490,6 +490,12 @@ static struct wpabuf * wpa_supplicant_extra_ies(struct wpa_supplicant *wpa_s)
 		wpabuf_put_buf(extra_ie, wpa_s->fst_ies);
 #endif /* CONFIG_FST */
 
+#ifdef CONFIG_MBO
+	/* Send cellular capabilities for potential MBO STAs */
+	if (wpabuf_resize(&extra_ie, 9) == 0)
+		wpas_mbo_scan_ie(wpa_s, extra_ie);
+#endif /* CONFIG_MBO */
+
 	return extra_ie;
 }
 
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index e03b619..3737dd4 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1147,6 +1147,7 @@ int wpas_mbo_ie(struct wpa_supplicant *wpa_s, u8 *buf, size_t len);
 const u8 *wpas_mbo_get_bss_attr(struct wpa_supplicant *wpa_s,
 				struct wpa_bss *bss, enum mbo_attr_id attr);
 int wpas_mbo_update_np_chan(struct wpa_supplicant *wpa_s, const char *np_chan);
+void wpas_mbo_scan_ie(struct wpa_supplicant *wpa_s, struct wpabuf *ie);
 
 /**
  * wpa_supplicant_ctrl_iface_ctrl_rsp_handle - Handle a control response
-- 
1.9.1




More information about the Hostap mailing list