[PATCH 1/1] dbus: Add D-Bus property for PSK mismatch heuristics

Jouni Malinen j at w1.fi
Sun Dec 18 08:39:56 PST 2022


On Sat, Dec 17, 2022 at 12:10:18AM +0000, Yichen Yu wrote:
> As a workup action during disassociation, wpa_supplicant checks if the
> disconnection is caused by PSK mismatch during WPA 4way handshake with
> function 'could_be_psk_mismatch' in event.c. A MSG_INFO will be logged
> when there could be a PSK mismatch, and this heuristic can be useful to
> indicate if the disconnection is caused by a wrong passphrase provided
> by the user.
> 
> Here, a new property 'PskMismatch' is added and a corresponding D-Bus
> PropertiesChanged signal is propogated to notify other applicantions.

Why would this be a new property instead of a signal?

>  wpa_supplicant/dbus/dbus_new.c          |  9 +++++++++
>  wpa_supplicant/dbus/dbus_new.h          |  1 +
>  wpa_supplicant/dbus/dbus_new_handlers.c | 20 ++++++++++++++++++++
>  wpa_supplicant/dbus/dbus_new_handlers.h |  1 +
>  wpa_supplicant/events.c                 |  1 +
>  wpa_supplicant/notify.c                 |  8 ++++++++
>  wpa_supplicant/notify.h                 |  1 +

doc/dbus.doxygen should also be updated. This should be clearly
identified as a possible PSK mismatch, i.e., it is possible for the
report to be incorrect and based on something else even if the PSK were
correct.

> diff --git a/wpa_supplicant/dbus/dbus_new_handlers.c b/wpa_supplicant/dbus/dbus_new_handlers.c
> +/**
> + * wpas_dbus_getter_psk_mismatch - Get true when PSK mismatches
> + * @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 "PskMismatch" property.
> + */
> +dbus_bool_t wpas_dbus_getter_psk_mismatch(
> +	const struct wpa_dbus_property_desc *property_desc,
> +	DBusMessageIter *iter, DBusError *error, void *user_data)
> +{
> +	dbus_bool_t is_psk_mismatch = TRUE;
> +
> +	return wpas_dbus_simple_property_getter(iter, DBUS_TYPE_BOOLEAN,
> +						&is_psk_mismatch, error);
> +}

This feels strange.. Is it really correct to return a hardcoded true for
PskMismatch under all conditions regardless of whether there has been a
failed attempt at using PSK?

-- 
Jouni Malinen                                            PGP id EFC895FA



More information about the Hostap mailing list