mirror of
https://github.com/vanhoefm/fragattacks.git
synced 2024-11-25 00:38:24 -05:00
dbus: Add getter for WPS properties
Add "WPS" property to the DBus interface that allows to identify the active WPS method of a BSS. Signed-hostap: Sven Neumann <s.neumann@raumfeld.com>
This commit is contained in:
parent
7d81932d27
commit
caff399250
@ -2236,6 +2236,10 @@ static const struct wpa_dbus_property_desc wpas_dbus_bss_properties[] = {
|
||||
wpas_dbus_getter_bss_rsn,
|
||||
NULL
|
||||
},
|
||||
{ "WPS", WPAS_DBUS_NEW_IFACE_BSS, "a{sv}",
|
||||
wpas_dbus_getter_bss_wps,
|
||||
NULL
|
||||
},
|
||||
{ "IEs", WPAS_DBUS_NEW_IFACE_BSS, "ay",
|
||||
wpas_dbus_getter_bss_ies,
|
||||
NULL
|
||||
|
@ -39,6 +39,7 @@ enum wpas_dbus_bss_prop {
|
||||
WPAS_DBUS_BSS_PROP_RATES,
|
||||
WPAS_DBUS_BSS_PROP_WPA,
|
||||
WPAS_DBUS_BSS_PROP_RSN,
|
||||
WPAS_DBUS_BSS_PROP_WPS,
|
||||
WPAS_DBUS_BSS_PROP_IES,
|
||||
};
|
||||
|
||||
|
@ -3403,6 +3403,63 @@ dbus_bool_t wpas_dbus_getter_bss_rsn(DBusMessageIter *iter, DBusError *error,
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_getter_bss_wps - Return the WPS options of a BSS
|
||||
* @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 "WPS" property.
|
||||
*/
|
||||
dbus_bool_t wpas_dbus_getter_bss_wps(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data)
|
||||
{
|
||||
struct bss_handler_args *args = user_data;
|
||||
struct wpa_bss *res;
|
||||
#ifdef CONFIG_WPS
|
||||
struct wpabuf *wps_ie;
|
||||
#endif /* CONFIG_WPS */
|
||||
DBusMessageIter iter_dict, variant_iter;
|
||||
const char *type = "";
|
||||
|
||||
res = get_bss_helper(args, error, __func__);
|
||||
if (!res)
|
||||
return FALSE;
|
||||
|
||||
if (!dbus_message_iter_open_container(iter, DBUS_TYPE_VARIANT,
|
||||
"a{sv}", &variant_iter))
|
||||
goto nomem;
|
||||
|
||||
if (!wpa_dbus_dict_open_write(&variant_iter, &iter_dict))
|
||||
goto nomem;
|
||||
|
||||
#ifdef CONFIG_WPS
|
||||
wps_ie = wpa_bss_get_vendor_ie_multi(res, WPS_IE_VENDOR_TYPE);
|
||||
if (wps_ie) {
|
||||
if (wps_is_selected_pbc_registrar(wps_ie))
|
||||
type = "pbc";
|
||||
else if (wps_is_selected_pin_registrar(wps_ie))
|
||||
type = "pin";
|
||||
}
|
||||
#endif /* CONFIG_WPS */
|
||||
|
||||
if (!wpa_dbus_dict_append_string(&iter_dict, "Type", type))
|
||||
goto nomem;
|
||||
|
||||
if (!wpa_dbus_dict_close_write(&variant_iter, &iter_dict))
|
||||
goto nomem;
|
||||
if (!dbus_message_iter_close_container(iter, &variant_iter))
|
||||
goto nomem;
|
||||
|
||||
return TRUE;
|
||||
|
||||
nomem:
|
||||
dbus_set_error_const(error, DBUS_ERROR_NO_MEMORY, "no memory");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* wpas_dbus_getter_bss_ies - Return all IEs of a BSS
|
||||
* @iter: Pointer to incoming dbus message iter
|
||||
|
@ -242,6 +242,9 @@ dbus_bool_t wpas_dbus_getter_bss_wpa(DBusMessageIter *iter, DBusError *error,
|
||||
dbus_bool_t wpas_dbus_getter_bss_rsn(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_wps(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
dbus_bool_t wpas_dbus_getter_bss_ies(DBusMessageIter *iter, DBusError *error,
|
||||
void *user_data);
|
||||
|
||||
|
@ -323,6 +323,9 @@ void wpas_notify_bss_rsnie_changed(struct wpa_supplicant *wpa_s,
|
||||
void wpas_notify_bss_wps_changed(struct wpa_supplicant *wpa_s,
|
||||
unsigned int id)
|
||||
{
|
||||
#ifdef CONFIG_WPS
|
||||
wpas_dbus_bss_signal_prop_changed(wpa_s, WPAS_DBUS_BSS_PROP_WPS, id);
|
||||
#endif /* CONFIG_WPS */
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user