core: add handlers for SaePasswordMismatch signal

Trigger a new auth request to the user when the SaePasswordMismatch
signal is received from wpa_supplicant.

Closes #904
This commit is contained in:
Mitchell Augustin 2025-10-03 11:32:34 -05:00 committed by Mitchell Augustin
parent 561fff3c8d
commit bcb96a1b19
3 changed files with 51 additions and 0 deletions

View file

@ -194,6 +194,9 @@ static void supplicant_iface_notify_p2p_available(NMSupplicantInterface *iface,
static void supplicant_iface_notify_wpa_psk_mismatch_cb(NMSupplicantInterface *iface,
NMDeviceWifi *self);
static void supplicant_iface_notify_wpa_sae_mismatch_cb(NMSupplicantInterface *iface,
NMDeviceWifi *self);
static void periodic_update(NMDeviceWifi *self);
static void ap_add_remove(NMDeviceWifi *self,
@ -631,6 +634,10 @@ supplicant_interface_acquire_cb(NMSupplicantManager *supplicant_manager,
NM_SUPPLICANT_INTERFACE_PSK_MISMATCH,
G_CALLBACK(supplicant_iface_notify_wpa_psk_mismatch_cb),
self);
g_signal_connect(priv->sup_iface,
NM_SUPPLICANT_INTERFACE_SAE_MISMATCH,
G_CALLBACK(supplicant_iface_notify_wpa_sae_mismatch_cb),
self);
_scan_notify_is_scanning(self);
@ -2879,6 +2886,34 @@ supplicant_iface_notify_wpa_psk_mismatch_cb(NMSupplicantInterface *iface, NMDevi
| NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW);
}
static void
supplicant_iface_notify_wpa_sae_mismatch_cb(NMSupplicantInterface *iface, NMDeviceWifi *self)
{
NMDevice *device = NM_DEVICE(self);
NMActRequest *req;
const char *setting_name = NM_SETTING_WIRELESS_SECURITY_SETTING_NAME;
if (nm_device_get_state(device) != NM_DEVICE_STATE_CONFIG)
return;
_LOGI(LOGD_DEVICE | LOGD_WIFI,
"Activation: (wifi) SAE password mismatch reported by supplicant, asking for new key");
req = nm_device_get_act_request(NM_DEVICE(self));
g_return_if_fail(req != NULL);
nm_act_request_clear_secrets(req);
cleanup_association_attempt(self, TRUE);
nm_device_state_changed(device,
NM_DEVICE_STATE_NEED_AUTH,
NM_DEVICE_STATE_REASON_SUPPLICANT_DISCONNECT);
wifi_secrets_get_secrets(self,
setting_name,
NM_SECRET_AGENT_GET_SECRETS_FLAG_ALLOW_INTERACTION
| NM_SECRET_AGENT_GET_SECRETS_FLAG_REQUEST_NEW);
}
/*
* supplicant_connection_timeout_cb
*

View file

@ -66,6 +66,7 @@ enum {
GROUP_STARTED, /* a new Group (interface) was created */
GROUP_FINISHED, /* a Group (interface) has been finished */
PSK_MISMATCH, /* supplicant reported incorrect PSK */
SAE_MISMATCH, /* supplicant reported incorrect SAE Password */
LAST_SIGNAL
};
@ -3110,6 +3111,11 @@ _signal_handle(NMSupplicantInterface *self,
g_signal_emit(self, signals[PSK_MISMATCH], 0);
return;
}
if (nm_streq(signal_name, "SaePasswordMismatch")) {
g_signal_emit(self, signals[SAE_MISMATCH], 0);
return;
}
return;
}
@ -3752,4 +3758,13 @@ nm_supplicant_interface_class_init(NMSupplicantInterfaceClass *klass)
NULL,
G_TYPE_NONE,
0);
signals[SAE_MISMATCH] = g_signal_new(NM_SUPPLICANT_INTERFACE_SAE_MISMATCH,
G_OBJECT_CLASS_TYPE(object_class),
G_SIGNAL_RUN_LAST,
0,
NULL,
NULL,
NULL,
G_TYPE_NONE,
0);
}

View file

@ -87,6 +87,7 @@ typedef enum {
#define NM_SUPPLICANT_INTERFACE_GROUP_STARTED "group-started"
#define NM_SUPPLICANT_INTERFACE_GROUP_FINISHED "group-finished"
#define NM_SUPPLICANT_INTERFACE_PSK_MISMATCH "wpa-psk-mismatch"
#define NM_SUPPLICANT_INTERFACE_SAE_MISMATCH "wpa-sae-password-mismatch"
typedef struct _NMSupplicantInterfaceClass NMSupplicantInterfaceClass;