From 80d06d0ca9f3b2986e89c8169087b7a71487bf95 Mon Sep 17 00:00:00 2001 From: Matthew Wang Date: Fri, 4 May 2018 11:16:18 -0700 Subject: [PATCH] dbus: Export BSS Transition Management status Add 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 --- 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 3e924862e..f4584f4f4 100644 --- a/doc/dbus.doxygen +++ b/doc/dbus.doxygen @@ -789,6 +789,11 @@ fi.w1.wpa_supplicant1.CreateInterface.

The most recent BSS session length in milliseconds.

+
  • +

    BSSTMStatus - u - (read)

    +

    The most recent BSS Transition Management status code.

    +
  • +
  • EapolVersion - s - (read/write)

    IEEE 802.1X/EAPOL version number

    diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index 04e1b6a10..ed2659bad 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -2244,6 +2244,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); @@ -2866,6 +2869,12 @@ static const struct wpa_dbus_property_desc wpas_dbus_bss_properties[] = { NULL, NULL }, + { + "BSSTMStatus", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", + 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 67d0f57ca..ef16b3682 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 d2b86c1de..60557db34 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -3178,6 +3178,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_uint32_t bss_tm_status = wpa_s->bss_tm_status; + + return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT32, + &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 19d03446c..f14df3e35 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.h +++ b/wpa_supplicant/dbus/dbus_new_handlers.h @@ -154,6 +154,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 a9d567114..530548f9c 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 560b07128..22a21361a 100644 --- a/wpa_supplicant/wnm_sta.c +++ b/wpa_supplicant/wnm_sta.c @@ -21,6 +21,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 @@ -1015,6 +1016,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 6bedcdd90..2b0b0886c 100644 --- a/wpa_supplicant/wpa_supplicant_i.h +++ b/wpa_supplicant/wpa_supplicant_i.h @@ -1065,6 +1065,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; struct wpabuf *coloc_intf_elems; u8 coloc_intf_dialog_token; u8 coloc_intf_auto_report;