mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-05-05 05:18:23 +02:00
wifi: merge branch 'th/connection-timestamp-for-wifi'
https://bugzilla.redhat.com/show_bug.cgi?id=1781253 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/524
This commit is contained in:
commit
6022af9963
4 changed files with 26 additions and 16 deletions
4
NEWS
4
NEWS
|
|
@ -30,6 +30,10 @@ USE AT YOUR OWN RISK. NOT RECOMMENDED FOR PRODUCTION USE!
|
|||
deactivating device.
|
||||
* Support ethtool coalesce and ring options.
|
||||
* Allow team connections to work without D-Bus (e.g. in the initrd).
|
||||
* Wi-Fi profiles now also autoconnect if all previous activation attempts
|
||||
failed. This means, an initial failure to autoconnect to the network will
|
||||
no longer block the automatism. A side effect is that existing Wi-Fi profiles
|
||||
which previously were blocked may now start to autoconnect.
|
||||
|
||||
=============================================
|
||||
NetworkManager-1.24
|
||||
|
|
|
|||
|
|
@ -1287,7 +1287,6 @@ can_auto_connect (NMDevice *device,
|
|||
NMWifiAP *ap;
|
||||
const char *method6, *mode;
|
||||
gboolean auto4, auto6;
|
||||
guint64 timestamp = 0;
|
||||
|
||||
nm_assert (!specific_object || !*specific_object);
|
||||
|
||||
|
|
@ -1315,15 +1314,6 @@ can_auto_connect (NMDevice *device,
|
|||
else if (!auto4 && !auto6 && nm_streq0 (mode, NM_SETTING_WIRELESS_MODE_MESH))
|
||||
return TRUE;
|
||||
|
||||
/* Don't autoconnect to networks that have been tried at least once
|
||||
* but haven't been successful, since these are often accidental choices
|
||||
* from the menu and the user may not know the password.
|
||||
*/
|
||||
if (nm_settings_connection_get_timestamp (sett_conn, ×tamp)) {
|
||||
if (timestamp == 0)
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
ap = nm_wifi_aps_find_first_compatible (&priv->aps_lst_head, connection);
|
||||
if (ap) {
|
||||
/* All good; connection is usable */
|
||||
|
|
|
|||
|
|
@ -7344,12 +7344,19 @@ periodic_update_active_connection_timestamps (gpointer user_data)
|
|||
NMManager *manager = NM_MANAGER (user_data);
|
||||
NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE (manager);
|
||||
NMActiveConnection *ac;
|
||||
gboolean has_time = FALSE;
|
||||
guint64 t;
|
||||
|
||||
c_list_for_each_entry (ac, &priv->active_connections_lst_head, active_connections_lst) {
|
||||
if (nm_active_connection_get_state (ac) == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
|
||||
nm_settings_connection_update_timestamp (nm_active_connection_get_settings_connection (ac),
|
||||
(guint64) time (NULL));
|
||||
if (nm_active_connection_get_state (ac) != NM_ACTIVE_CONNECTION_STATE_ACTIVATED)
|
||||
continue;
|
||||
|
||||
if (!has_time) {
|
||||
t = time (NULL);
|
||||
has_time = TRUE;
|
||||
}
|
||||
nm_settings_connection_update_timestamp (nm_active_connection_get_settings_connection (ac),
|
||||
t);
|
||||
}
|
||||
return G_SOURCE_CONTINUE;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2136,15 +2136,24 @@ void
|
|||
nm_settings_connection_update_timestamp (NMSettingsConnection *self,
|
||||
guint64 timestamp)
|
||||
{
|
||||
NMSettingsConnectionPrivate *priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
||||
NMSettingsConnectionPrivate *priv;
|
||||
const char *connection_uuid;
|
||||
char sbuf[60];
|
||||
|
||||
g_return_if_fail (NM_IS_SETTINGS_CONNECTION (self));
|
||||
|
||||
priv = NM_SETTINGS_CONNECTION_GET_PRIVATE (self);
|
||||
|
||||
if ( priv->timestamp == timestamp
|
||||
&& priv->timestamp_set)
|
||||
return;
|
||||
|
||||
priv->timestamp = timestamp;
|
||||
priv->timestamp_set = TRUE;
|
||||
|
||||
_LOGT ("timestamp: set timestamp %"G_GUINT64_FORMAT,
|
||||
timestamp);
|
||||
|
||||
if (!priv->kf_db_timestamps)
|
||||
return;
|
||||
|
||||
|
|
@ -2185,10 +2194,10 @@ _nm_settings_connection_register_kf_dbs (NMSettingsConnection *self,
|
|||
if (timestamp != G_MAXUINT64) {
|
||||
priv->timestamp = timestamp;
|
||||
priv->timestamp_set = TRUE;
|
||||
_LOGT ("read timestamp %"G_GUINT64_FORMAT" from keyfile database \"%s\"",
|
||||
_LOGT ("timestamp: read timestamp %"G_GUINT64_FORMAT" from keyfile database \"%s\"",
|
||||
timestamp, nm_key_file_db_get_filename (priv->kf_db_timestamps));
|
||||
} else
|
||||
_LOGT ("no timestamp from keyfile database \"%s\"",
|
||||
_LOGT ("timestamp: no timestamp from keyfile database \"%s\"",
|
||||
nm_key_file_db_get_filename (priv->kf_db_timestamps));
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue