device: add public method nm_device_auth_retries_has_next

Devices don't know whether they have authentication retries left,
so they can only make decisions ad-hoc after calling
nm_device_auth_retries_try_next.

Giving devices a way to determine whether the current attempt is their
last attempt, allows them to make decisions before failing a connection.
This commit is contained in:
Jan Fooken 2025-11-04 09:35:27 +01:00
parent a3267aaf7b
commit 6dc51ddf01
No known key found for this signature in database
GPG key ID: 637B49B64674EEE2
2 changed files with 19 additions and 0 deletions

View file

@ -18947,6 +18947,24 @@ _device_get_auth_retries(NMDevice *self)
return auth_retries;
}
gboolean
nm_device_auth_retries_has_next(NMDevice *self)
{
int auth_retries;
g_return_val_if_fail(NM_IS_DEVICE(self), FALSE);
auth_retries = _device_get_auth_retries(self);
if (auth_retries == NM_DEVICE_AUTH_RETRIES_INFINITY)
return TRUE;
if (auth_retries > 0)
return TRUE;
return FALSE;
}
gboolean
nm_device_auth_retries_try_next(NMDevice *self)
{

View file

@ -791,6 +791,7 @@ void nm_device_update_permanent_hw_address(NMDevice *self, gboolean force_fr
void nm_device_update_dynamic_ip_setup(NMDevice *self, const char *reason);
guint nm_device_get_supplicant_timeout(NMDevice *self);
gboolean nm_device_auth_retries_has_next(NMDevice *self);
gboolean nm_device_auth_retries_try_next(NMDevice *self);
gboolean nm_device_hw_addr_get_cloned(NMDevice *self,