]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
dbus: Add D-Bus signal for PSK mismatch heuristics
authorYichen Yu <yichenyu@chromium.org>
Tue, 20 Dec 2022 07:08:41 +0000 (07:08 +0000)
committerJouni Malinen <j@w1.fi>
Tue, 21 Feb 2023 09:24:06 +0000 (11:24 +0200)
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>
doc/dbus.doxygen
wpa_supplicant/dbus/dbus_new.c
wpa_supplicant/dbus/dbus_new.h
wpa_supplicant/events.c
wpa_supplicant/notify.c
wpa_supplicant/notify.h

index f75917c2ab905c57797b4985c5788ac1550a290a..87f4c02fbbd4c4187b76f5a499730d369fe3fe2e 100644 (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>
 
 
index 9c23588c8753b7a219118b3c1a4ddc8e8a17f0cb..8fc29b3985135e5660209c2ebde3848a10775afe 100644 (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
index ca8506f879dc4fc63ecbb09e001f62ab42969c2e..5c5d85506200433315a44331ae913229036eb3d8 100644 (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)
index c3f0e744e2255ef79c09ff6ef7d871e2fe905096..e58a3da8356e6a6e6f265956d44dd0092a72153e 100644 (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);
index d8a64327c39d3de9cff01a7e090902b78dbf8995..4b4a34b52d626652d7d11d5f1a6a4f321043163e 100644 (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)
 {
index 78ae4bcb15148b89061ac689917fc908d7931d5b..efb9efa078f5883b609bfd508e0bf5571c09803d 100644 (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,