dbus: Add D-Bus signal for PSK mismatch heuristics

As a workup action during disassociation, wpa_supplicant checks if the
disconnection could have been caused by PSK mismatch during WPA 4-way
handshake with function could_be_psk_mismatch() in event.c. A MSG_INFO
message will be sent on the control interface 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, propagate a new D-Bus signal 'PskMismatch' to notify other
applicantions.

Signed-off-by: Yichen Yu <yichenyu@chromium.org>
This commit is contained in:
Yichen Yu 2022-12-20 07:08:41 +00:00 committed by Jouni Malinen
parent 691f729d5d
commit a678a510fb
6 changed files with 41 additions and 0 deletions

View file

@ -1329,6 +1329,11 @@ fi.w1.wpa_supplicant1.CreateInterface.
<li>
<h3>InterworkingSelectDone ( )</h3>
</li>
<li>
<h3>PskMismatch ( )</h3>
<p>A possible PSK mismatch is identified.</p>
</li>
</ul>

View file

@ -1102,6 +1102,29 @@ void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
}
void wpas_dbus_signal_psk_mismatch(struct wpa_supplicant *wpa_s)
{
struct wpas_dbus_priv *iface;
DBusMessage *msg;
iface = wpa_s->global->dbus;
/* Do nothing if the control interface is not turned on */
if (!iface || !wpa_s->dbus_new_path)
return;
msg = dbus_message_new_signal(wpa_s->dbus_new_path,
WPAS_DBUS_NEW_IFACE_INTERFACE,
"PskMismatch");
if (!msg)
return;
dbus_connection_send(iface->con, msg, NULL);
dbus_message_unref(msg);
}
/**
* wpas_dbus_signal_sta - Send a station related event signal
* @wpa_s: %wpa_supplicant network interface data

View file

@ -254,6 +254,7 @@ void wpas_dbus_signal_preq(struct wpa_supplicant *wpa_s,
const u8 *ie, size_t ie_len, u32 ssi_signal);
void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
const char *status, const char *parameter);
void wpas_dbus_signal_psk_mismatch(struct wpa_supplicant *wpa_s);
void wpas_dbus_signal_sta_authorized(struct wpa_supplicant *wpa_s,
const u8 *sta);
void wpas_dbus_signal_sta_deauthorized(struct wpa_supplicant *wpa_s,
@ -585,6 +586,10 @@ static inline void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
{
}
static inline void wpas_dbus_signal_psk_mismatch(struct wpa_supplicant *wpa_s)
{
}
static inline
void wpas_dbus_signal_sta_authorized(struct wpa_supplicant *wpa_s,
const u8 *sta)

View file

@ -3977,6 +3977,7 @@ static void wpa_supplicant_event_disassoc_finish(struct wpa_supplicant *wpa_s,
if (wpas_p2p_4way_hs_failed(wpa_s) > 0)
return; /* P2P group removed */
wpas_auth_failed(wpa_s, "WRONG_KEY", prev_pending_bssid);
wpas_notify_psk_mismatch(wpa_s);
#ifdef CONFIG_DPP2
wpas_dpp_send_conn_status_result(wpa_s,
DPP_STATUS_AUTH_FAILURE);

View file

@ -877,6 +877,12 @@ void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
}
void wpas_notify_psk_mismatch(struct wpa_supplicant *wpa_s)
{
wpas_dbus_signal_psk_mismatch(wpa_s);
}
void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid)
{

View file

@ -143,6 +143,7 @@ void wpas_notify_preq(struct wpa_supplicant *wpa_s,
void wpas_notify_eap_status(struct wpa_supplicant *wpa_s, const char *status,
const char *parameter);
void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code);
void wpas_notify_psk_mismatch(struct wpa_supplicant *wpa_s);
void wpas_notify_network_bssid_set_changed(struct wpa_supplicant *wpa_s,
struct wpa_ssid *ssid);
void wpas_notify_network_type_changed(struct wpa_supplicant *wpa_s,