dbus: export BSS Transition Management status to dbus

Message ID 20180504010052.66020-1-matthewmwang@chromium.org
State Superseded
Headers show
Series
  • dbus: export BSS Transition Management status to dbus
Related show

Commit Message

Matthew Wang May 4, 2018, 1 a.m.
Added new Interface properties "BSSTMStatus", which carries the status of
the most recent BSS Transition Management request. This property will be
logged in UMA to measure 802.11v success.

Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
---
 doc/dbus.doxygen                        |  5 +++++
 wpa_supplicant/dbus/dbus_new.c          |  9 +++++++++
 wpa_supplicant/dbus/dbus_new.h          |  1 +
 wpa_supplicant/dbus/dbus_new_handlers.c | 22 ++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new_handlers.h |  1 +
 wpa_supplicant/notify.c                 |  9 +++++++++
 wpa_supplicant/notify.h                 |  1 +
 wpa_supplicant/wnm_sta.c                |  4 ++++
 wpa_supplicant/wpa_supplicant_i.h       |  1 +
 9 files changed, 53 insertions(+)

Comments

Dan Williams May 4, 2018, 2:47 p.m. | #1
On Thu, 2018-05-03 at 18:00 -0700, Matthew Wang wrote:
> Added new Interface properties "BSSTMStatus", which carries the
> status of
> the most recent BSS Transition Management request. This property will
> be
> logged in UMA to measure 802.11v success.
> 
> Signed-off-by: Matthew Wang <matthewmwang@chromium.org>
> ---
>  doc/dbus.doxygen                        |  5 +++++
>  wpa_supplicant/dbus/dbus_new.c          |  9 +++++++++
>  wpa_supplicant/dbus/dbus_new.h          |  1 +
>  wpa_supplicant/dbus/dbus_new_handlers.c | 22 ++++++++++++++++++++++
>  wpa_supplicant/dbus/dbus_new_handlers.h |  1 +
>  wpa_supplicant/notify.c                 |  9 +++++++++
>  wpa_supplicant/notify.h                 |  1 +
>  wpa_supplicant/wnm_sta.c                |  4 ++++
>  wpa_supplicant/wpa_supplicant_i.h       |  1 +
>  9 files changed, 53 insertions(+)
> 
> diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
> index d3003b31d..cf5129474 100644
> --- a/doc/dbus.doxygen
> +++ b/doc/dbus.doxygen
> @@ -784,6 +784,11 @@ fi.w1.wpa_supplicant1.CreateInterface.
>  	<p>The most recent BSS session length in milliseconds.</p>
>        </li>
>  
> +      <li>
> +	<h3>BSSTMStatus - i - (read)</h3>
> +	<p>The most recent BSS Transition Management status
> code.</p>
> +      </li>

Is this ever going to be less than zero?  The enum won't be.

>        <li>
>  	<h3>EapolVersion - s - (read/write)</h3>
>  	<p>IEEE 802.1X/EAPOL version number</p>
> diff --git a/wpa_supplicant/dbus/dbus_new.c
> b/wpa_supplicant/dbus/dbus_new.c
> index 168e9baf6..2f4b2bf46 100644
> --- a/wpa_supplicant/dbus/dbus_new.c
> +++ b/wpa_supplicant/dbus/dbus_new.c
> @@ -2171,6 +2171,9 @@ void wpas_dbus_signal_prop_changed(struct
> wpa_supplicant *wpa_s,
>  	case WPAS_DBUS_PROP_SESSION_LENGTH:
>  		prop = "SessionLength";
>  		break;
> +	case WPAS_DBUS_PROP_BSS_TM_STATUS:
> +		prop = "BSSTMStatus";
> +		break;
>  	default:
>  		wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property
> value %d",
>  			   __func__, property);
> @@ -2758,6 +2761,12 @@ static const struct wpa_dbus_property_desc
> wpas_dbus_bss_properties[] = {
>  	  NULL,
>  	  NULL
>  	},
> +	{
> +	  "BSSTMStatus", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
> +	  wpas_dbus_getter_bss_tm_status,
> +	  NULL,
> +	  NULL
> +	},
>  	{ NULL, NULL, NULL, NULL, NULL, NULL }
>  };
>  
> diff --git a/wpa_supplicant/dbus/dbus_new.h
> b/wpa_supplicant/dbus/dbus_new.h
> index 08f4858b1..bec9a4153 100644
> --- a/wpa_supplicant/dbus/dbus_new.h
> +++ b/wpa_supplicant/dbus/dbus_new.h
> @@ -34,6 +34,7 @@ enum wpas_dbus_prop {
>  	WPAS_DBUS_PROP_ROAM_TIME,
>  	WPAS_DBUS_PROP_ROAM_COMPLETE,
>  	WPAS_DBUS_PROP_SESSION_LENGTH,
> +	WPAS_DBUS_PROP_BSS_TM_STATUS,
>  };
>  
>  enum wpas_dbus_bss_prop {
> diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c
> b/wpa_supplicant/dbus/dbus_new_handlers.c
> index 4e3412cdc..367d26d14 100644
> --- a/wpa_supplicant/dbus/dbus_new_handlers.c
> +++ b/wpa_supplicant/dbus/dbus_new_handlers.c
> @@ -3223,6 +3223,28 @@ dbus_bool_t wpas_dbus_getter_session_length(
>  }
>  
>  
> +/**
> + * wpas_dbus_getter_bss_tm_status - Get most BSS Transition
> Management request
> + * status code
> + * @iter: Pointer to incoming dbus message iter
> + * @error: Location to store error on failure
> + * @user_data: Function specific data
> + * Returns: TRUE on success, FALSE on failure
> + *
> + * Getter for "BSSTMStatus" property.
> + */
> +dbus_bool_t wpas_dbus_getter_bss_tm_status(
> +	const struct wpa_dbus_property_desc *property_desc,
> +	DBusMessageIter *iter, DBusError *error, void *user_data)
> +{
> +	struct wpa_supplicant *wpa_s = user_data;
> +	dbus_int32_t bss_tm_status = wpa_s->bss_tm_status;
> +
> +	return wpas_dbus_simple_property_getter(iter,
> DBUS_TYPE_INT32,
> +						&bss_tm_status,
> error);
> +}
> +
> +
>  /**
>   * wpas_dbus_getter_bss_expire_age - Get BSS entry expiration age
>   * @iter: Pointer to incoming dbus message iter
> diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h
> b/wpa_supplicant/dbus/dbus_new_handlers.h
> index 7a03b7f9f..25ab9991c 100644
> --- a/wpa_supplicant/dbus/dbus_new_handlers.h
> +++ b/wpa_supplicant/dbus/dbus_new_handlers.h
> @@ -151,6 +151,7 @@
> DECLARE_ACCESSOR(wpas_dbus_getter_assoc_status_code);
>  DECLARE_ACCESSOR(wpas_dbus_getter_roam_time);
>  DECLARE_ACCESSOR(wpas_dbus_getter_roam_complete);
>  DECLARE_ACCESSOR(wpas_dbus_getter_session_length);
> +DECLARE_ACCESSOR(wpas_dbus_getter_bss_tm_status);
>  DECLARE_ACCESSOR(wpas_dbus_getter_bss_expire_age);
>  DECLARE_ACCESSOR(wpas_dbus_setter_bss_expire_age);
>  DECLARE_ACCESSOR(wpas_dbus_getter_bss_expire_count);
> diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
> index a2b04716d..b171e8e87 100644
> --- a/wpa_supplicant/notify.c
> +++ b/wpa_supplicant/notify.c
> @@ -176,6 +176,15 @@ void wpas_notify_session_length(struct
> wpa_supplicant *wpa_s)
>  }
>  
>  
> +void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
> +{
> +	if (wpa_s->p2p_mgmt)
> +		return;
> +
> +	wpas_dbus_signal_prop_changed(wpa_s,
> WPAS_DBUS_PROP_BSS_TM_STATUS);
> +}
> +
> +
>  void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
>  {
>  	if (wpa_s->p2p_mgmt)
> diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
> index bde20e83d..9605785cf 100644
> --- a/wpa_supplicant/notify.h
> +++ b/wpa_supplicant/notify.h
> @@ -27,6 +27,7 @@ void wpas_notify_assoc_status_code(struct
> wpa_supplicant *wpa_s);
>  void wpas_notify_roam_time(struct wpa_supplicant *wpa_s);
>  void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s);
>  void wpas_notify_session_length(struct wpa_supplicant *wpa_s);
> +void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s);
>  void wpas_notify_network_changed(struct wpa_supplicant *wpa_s);
>  void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s);
>  void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s);
> diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
> index 7c410e730..1dbc90352 100644
> --- a/wpa_supplicant/wnm_sta.c
> +++ b/wpa_supplicant/wnm_sta.c
> @@ -20,6 +20,7 @@
>  #include "ctrl_iface.h"
>  #include "bss.h"
>  #include "wnm_sta.h"
> +#include "notify.h"
>  #include "hs20_supplicant.h"
>  
>  #define MAX_TFS_IE_LEN  1024
> @@ -938,6 +939,9 @@ static void wnm_send_bss_transition_mgmt_resp(
>  		return;
>  	}
>  
> +        wpa_s->bss_tm_status = status;
> +        wpas_notify_bss_tm_status(wpa_s);

Whitespace issues.

>  	wpabuf_put_u8(buf, WLAN_ACTION_WNM);
>  	wpabuf_put_u8(buf, WNM_BSS_TRANS_MGMT_RESP);
>  	wpabuf_put_u8(buf, dialog_token);
> diff --git a/wpa_supplicant/wpa_supplicant_i.h
> b/wpa_supplicant/wpa_supplicant_i.h
> index a4d56b810..70da2a4b1 100644
> --- a/wpa_supplicant/wpa_supplicant_i.h
> +++ b/wpa_supplicant/wpa_supplicant_i.h
> @@ -1059,6 +1059,7 @@ struct wpa_supplicant {
>  	struct neighbor_report *wnm_neighbor_report_elements;
>  	struct os_reltime wnm_cand_valid_until;
>  	u8 wnm_cand_from_bss[ETH_ALEN];
> +        enum bss_trans_mgmt_status_code bss_tm_status;

Whitespace issues here too.

Dan

>  #ifdef CONFIG_MBO
>  	unsigned int wnm_mbo_trans_reason_present:1;
>  	u8 wnm_mbo_transition_reason;

Patch

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index d3003b31d..cf5129474 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -784,6 +784,11 @@  fi.w1.wpa_supplicant1.CreateInterface.
 	<p>The most recent BSS session length in milliseconds.</p>
       </li>
 
+      <li>
+	<h3>BSSTMStatus - i - (read)</h3>
+	<p>The most recent BSS Transition Management status code.</p>
+      </li>
+
       <li>
 	<h3>EapolVersion - s - (read/write)</h3>
 	<p>IEEE 802.1X/EAPOL version number</p>
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 168e9baf6..2f4b2bf46 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -2171,6 +2171,9 @@  void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s,
 	case WPAS_DBUS_PROP_SESSION_LENGTH:
 		prop = "SessionLength";
 		break;
+	case WPAS_DBUS_PROP_BSS_TM_STATUS:
+		prop = "BSSTMStatus";
+		break;
 	default:
 		wpa_printf(MSG_ERROR, "dbus: %s: Unknown Property value %d",
 			   __func__, property);
@@ -2758,6 +2761,12 @@  static const struct wpa_dbus_property_desc wpas_dbus_bss_properties[] = {
 	  NULL,
 	  NULL
 	},
+	{
+	  "BSSTMStatus", WPAS_DBUS_NEW_IFACE_INTERFACE, "i",
+	  wpas_dbus_getter_bss_tm_status,
+	  NULL,
+	  NULL
+	},
 	{ NULL, NULL, NULL, NULL, NULL, NULL }
 };
 
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index 08f4858b1..bec9a4153 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -34,6 +34,7 @@  enum wpas_dbus_prop {
 	WPAS_DBUS_PROP_ROAM_TIME,
 	WPAS_DBUS_PROP_ROAM_COMPLETE,
 	WPAS_DBUS_PROP_SESSION_LENGTH,
+	WPAS_DBUS_PROP_BSS_TM_STATUS,
 };
 
 enum wpas_dbus_bss_prop {
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
index 4e3412cdc..367d26d14 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.c
+++ b/wpa_supplicant/dbus/dbus_new_handlers.c
@@ -3223,6 +3223,28 @@  dbus_bool_t wpas_dbus_getter_session_length(
 }
 
 
+/**
+ * wpas_dbus_getter_bss_tm_status - Get most BSS Transition Management request
+ * status code
+ * @iter: Pointer to incoming dbus message iter
+ * @error: Location to store error on failure
+ * @user_data: Function specific data
+ * Returns: TRUE on success, FALSE on failure
+ *
+ * Getter for "BSSTMStatus" property.
+ */
+dbus_bool_t wpas_dbus_getter_bss_tm_status(
+	const struct wpa_dbus_property_desc *property_desc,
+	DBusMessageIter *iter, DBusError *error, void *user_data)
+{
+	struct wpa_supplicant *wpa_s = user_data;
+	dbus_int32_t bss_tm_status = wpa_s->bss_tm_status;
+
+	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_INT32,
+						&bss_tm_status, error);
+}
+
+
 /**
  * wpas_dbus_getter_bss_expire_age - Get BSS entry expiration age
  * @iter: Pointer to incoming dbus message iter
diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h
index 7a03b7f9f..25ab9991c 100644
--- a/wpa_supplicant/dbus/dbus_new_handlers.h
+++ b/wpa_supplicant/dbus/dbus_new_handlers.h
@@ -151,6 +151,7 @@  DECLARE_ACCESSOR(wpas_dbus_getter_assoc_status_code);
 DECLARE_ACCESSOR(wpas_dbus_getter_roam_time);
 DECLARE_ACCESSOR(wpas_dbus_getter_roam_complete);
 DECLARE_ACCESSOR(wpas_dbus_getter_session_length);
+DECLARE_ACCESSOR(wpas_dbus_getter_bss_tm_status);
 DECLARE_ACCESSOR(wpas_dbus_getter_bss_expire_age);
 DECLARE_ACCESSOR(wpas_dbus_setter_bss_expire_age);
 DECLARE_ACCESSOR(wpas_dbus_getter_bss_expire_count);
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index a2b04716d..b171e8e87 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -176,6 +176,15 @@  void wpas_notify_session_length(struct wpa_supplicant *wpa_s)
 }
 
 
+void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s)
+{
+	if (wpa_s->p2p_mgmt)
+		return;
+
+	wpas_dbus_signal_prop_changed(wpa_s, WPAS_DBUS_PROP_BSS_TM_STATUS);
+}
+
+
 void wpas_notify_network_changed(struct wpa_supplicant *wpa_s)
 {
 	if (wpa_s->p2p_mgmt)
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index bde20e83d..9605785cf 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -27,6 +27,7 @@  void wpas_notify_assoc_status_code(struct wpa_supplicant *wpa_s);
 void wpas_notify_roam_time(struct wpa_supplicant *wpa_s);
 void wpas_notify_roam_complete(struct wpa_supplicant *wpa_s);
 void wpas_notify_session_length(struct wpa_supplicant *wpa_s);
+void wpas_notify_bss_tm_status(struct wpa_supplicant *wpa_s);
 void wpas_notify_network_changed(struct wpa_supplicant *wpa_s);
 void wpas_notify_ap_scan_changed(struct wpa_supplicant *wpa_s);
 void wpas_notify_bssid_changed(struct wpa_supplicant *wpa_s);
diff --git a/wpa_supplicant/wnm_sta.c b/wpa_supplicant/wnm_sta.c
index 7c410e730..1dbc90352 100644
--- a/wpa_supplicant/wnm_sta.c
+++ b/wpa_supplicant/wnm_sta.c
@@ -20,6 +20,7 @@ 
 #include "ctrl_iface.h"
 #include "bss.h"
 #include "wnm_sta.h"
+#include "notify.h"
 #include "hs20_supplicant.h"
 
 #define MAX_TFS_IE_LEN  1024
@@ -938,6 +939,9 @@  static void wnm_send_bss_transition_mgmt_resp(
 		return;
 	}
 
+        wpa_s->bss_tm_status = status;
+        wpas_notify_bss_tm_status(wpa_s);
+
 	wpabuf_put_u8(buf, WLAN_ACTION_WNM);
 	wpabuf_put_u8(buf, WNM_BSS_TRANS_MGMT_RESP);
 	wpabuf_put_u8(buf, dialog_token);
diff --git a/wpa_supplicant/wpa_supplicant_i.h b/wpa_supplicant/wpa_supplicant_i.h
index a4d56b810..70da2a4b1 100644
--- a/wpa_supplicant/wpa_supplicant_i.h
+++ b/wpa_supplicant/wpa_supplicant_i.h
@@ -1059,6 +1059,7 @@  struct wpa_supplicant {
 	struct neighbor_report *wnm_neighbor_report_elements;
 	struct os_reltime wnm_cand_valid_until;
 	u8 wnm_cand_from_bss[ETH_ALEN];
+        enum bss_trans_mgmt_status_code bss_tm_status;
 #ifdef CONFIG_MBO
 	unsigned int wnm_mbo_trans_reason_present:1;
 	u8 wnm_mbo_transition_reason;