[PATCH v2] dbus: Add D-Bus signal for PSK mismatch heuristics

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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, propagate a new D-Bus signal 'PskMismatch' to notify other applicantions.

Signed-off-by: Yichen Yu <yichenyu@xxxxxxxxxxxx>
---
 doc/dbus.doxygen               |  5 +++++
 wpa_supplicant/dbus/dbus_new.c | 22 ++++++++++++++++++++++
 wpa_supplicant/dbus/dbus_new.h |  5 +++++
 wpa_supplicant/events.c        |  1 +
 wpa_supplicant/notify.c        |  5 +++++
 wpa_supplicant/notify.h        |  1 +
 6 files changed, 39 insertions(+)

diff --git a/doc/dbus.doxygen b/doc/dbus.doxygen
index f75917c2a..87f4c02fb 100644
--- a/doc/dbus.doxygen
+++ b/doc/dbus.doxygen
@@ -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>
 
 
diff --git a/wpa_supplicant/dbus/dbus_new.c b/wpa_supplicant/dbus/dbus_new.c
index 9c23588c8..11d3b6792 100644
--- a/wpa_supplicant/dbus/dbus_new.c
+++ b/wpa_supplicant/dbus/dbus_new.c
@@ -1101,6 +1101,28 @@ void wpas_dbus_signal_eap_status(struct wpa_supplicant *wpa_s,
 	dbus_message_unref(msg);
 }
 
+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
diff --git a/wpa_supplicant/dbus/dbus_new.h b/wpa_supplicant/dbus/dbus_new.h
index ca8506f87..5c5d85506 100644
--- a/wpa_supplicant/dbus/dbus_new.h
+++ b/wpa_supplicant/dbus/dbus_new.h
@@ -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)
diff --git a/wpa_supplicant/events.c b/wpa_supplicant/events.c
index 64b2bcd1d..5e1289089 100644
--- a/wpa_supplicant/events.c
+++ b/wpa_supplicant/events.c
@@ -3940,6 +3940,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);
diff --git a/wpa_supplicant/notify.c b/wpa_supplicant/notify.c
index d8a64327c..66c3fcc70 100644
--- a/wpa_supplicant/notify.c
+++ b/wpa_supplicant/notify.c
@@ -876,6 +876,11 @@ void wpas_notify_eap_error(struct wpa_supplicant *wpa_s, int error_code)
 	wpa_msg(wpa_s, MSG_ERROR, WPA_EVENT_EAP_ERROR_CODE "%d", 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)
diff --git a/wpa_supplicant/notify.h b/wpa_supplicant/notify.h
index 78ae4bcb1..efb9efa07 100644
--- a/wpa_supplicant/notify.h
+++ b/wpa_supplicant/notify.h
@@ -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,

base-commit: 8b36248cd2fdc2150074109db794ca4c0cb6a34a
-- 
2.39.0.314.g84b9a713c41-goog


_______________________________________________
Hostap mailing list
Hostap@xxxxxxxxxxxxxxxxxxx
http://lists.infradead.org/mailman/listinfo/hostap



[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux