The Pmf property is documented in doc/dbus.doxygen, but does not exist, so implement it. Signed-off-by: Stijn Tintel <stijn@xxxxxxxxxxxxx> --- wpa_supplicant/dbus/dbus_new.c | 12 ++++++++ wpa_supplicant/dbus/dbus_new.h | 1 + wpa_supplicant/dbus/dbus_new_handlers.c | 51 +++++++++++++++++++++++++++++++++ wpa_supplicant/dbus/dbus_new_handlers.h | 2 ++ wpa_supplicant/wpa_supplicant.c | 19 ++++++++++++ 5 files changed, 85 insertions(+) diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c index a601182..0c355f7 100644 --- a/wpa_supplicant/dbus/dbus_new.c +++ b/wpa_supplicant/dbus/dbus_new.c @@ -1987,6 +1987,11 @@ void wpas_dbus_signal_prop_changed(struct wpa_supplicant *wpa_s, case WPAS_DBUS_PROP_AP_SCAN: prop = "ApScan"; break; +#ifdef CONFIG_IEEE80211W + case WPAS_DBUS_PROP_PMF: + prop = "Pmf"; + break; +#endif /* CONFIG_IEEE80211W */ case WPAS_DBUS_PROP_SCANNING: prop = "Scanning"; break; @@ -3138,6 +3143,13 @@ static const struct wpa_dbus_property_desc wpas_dbus_interface_properties[] = { wpas_dbus_setter_ap_scan, NULL }, +#ifdef CONFIG_IEEE80211W + { "Pmf", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", + wpas_dbus_getter_pmf, + wpas_dbus_setter_pmf, + NULL + }, +#endif /* CONFIG_IEEE80211W */ { "BSSExpireAge", WPAS_DBUS_NEW_IFACE_INTERFACE, "u", wpas_dbus_getter_bss_expire_age, wpas_dbus_setter_bss_expire_age, diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h index 2b0b775..bd0e074 100644 --- a/wpa_supplicant/dbus/dbus_new.h +++ b/wpa_supplicant/dbus/dbus_new.h @@ -22,6 +22,7 @@ struct wps_credential; enum wpas_dbus_prop { WPAS_DBUS_PROP_AP_SCAN, + WPAS_DBUS_PROP_PMF, WPAS_DBUS_PROP_SCANNING, WPAS_DBUS_PROP_STATE, WPAS_DBUS_PROP_CURRENT_BSS, diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c index 7446f8d..b25afc8 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.c +++ b/wpa_supplicant/dbus/dbus_new_handlers.c @@ -2786,6 +2786,57 @@ dbus_bool_t wpas_dbus_setter_ap_scan( return TRUE; } +#ifdef CONFIG_IEEE80211W +/** + * wpas_dbus_getter_pmf - Control PMF default + * @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 function for "Pmf" property. + */ +dbus_bool_t wpas_dbus_getter_pmf( + 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 pmf = wpa_s->conf->pmf; + + return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_UINT32, + &pmf, error); +} + + +/** + * wpas_dbus_setter_pmf - Control PMF default + * @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 + * + * Setter function for "Pmf" property. + */ +dbus_bool_t wpas_dbus_setter_pmf( + 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 pmf; + + if (!wpas_dbus_simple_property_setter(iter, error, DBUS_TYPE_UINT32, + &pmf)) + return FALSE; + + if (wpa_supplicant_set_pmf(wpa_s, pmf)) { + dbus_set_error_const(error, DBUS_ERROR_FAILED, + "pmf must be 0, 1, or 2"); + return FALSE; + } + return TRUE; +} +#endif /* CONFIG_IEEE80211W */ + /** * wpas_dbus_getter_fast_reauth - Control fast diff --git a/wpa_supplicant/dbus/dbus_new_handlers.h b/wpa_supplicant/dbus/dbus_new_handlers.h index fe8767a..3b8f096 100644 --- a/wpa_supplicant/dbus/dbus_new_handlers.h +++ b/wpa_supplicant/dbus/dbus_new_handlers.h @@ -138,6 +138,8 @@ DECLARE_ACCESSOR(wpas_dbus_getter_state); DECLARE_ACCESSOR(wpas_dbus_getter_scanning); DECLARE_ACCESSOR(wpas_dbus_getter_ap_scan); DECLARE_ACCESSOR(wpas_dbus_setter_ap_scan); +DECLARE_ACCESSOR(wpas_dbus_getter_pmf); +DECLARE_ACCESSOR(wpas_dbus_setter_pmf); DECLARE_ACCESSOR(wpas_dbus_getter_fast_reauth); DECLARE_ACCESSOR(wpas_dbus_setter_fast_reauth); DECLARE_ACCESSOR(wpas_dbus_getter_disconnect_reason); diff --git a/wpa_supplicant/wpa_supplicant.c b/wpa_supplicant/wpa_supplicant.c index ae62bd6..309f87d 100644 --- a/wpa_supplicant/wpa_supplicant.c +++ b/wpa_supplicant/wpa_supplicant.c @@ -3148,6 +3148,25 @@ int wpa_supplicant_set_ap_scan(struct wpa_supplicant *wpa_s, int ap_scan) return 0; } +#ifdef CONFIG_IEEE80211W +/** + * wpa_supplicant_set_pmf - Set PMF default for interface + * @wpa_s: wpa_supplicant structure for a network interface + * @pm: PMF default + * Returns: 0 if succeed or -1 if ap_scan has an invalid value + * + */ +int wpa_supplicant_set_pmf(struct wpa_supplicant *wpa_s, int pmf) +{ + if (pmf < 0 || pmf > 2) + return -1; + + wpa_s->conf->pmf = pmf; + + return 0; +} +#endif /* CONFIG_IEEE80211W */ + /** * wpa_supplicant_set_bss_expiration_age - Set BSS entry expiration age -- 2.10.2 _______________________________________________ Hostap mailing list Hostap@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/hostap