summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2023-04-28 11:47:20 +0200
committerThomas Haller <thaller@redhat.com>2023-05-04 10:34:12 +0200
commita019d965f72e1f8d59413f2df9e8d94cdfff84db (patch)
treeab4011d4ee022c045872d4a5d66776b3243f04ce
parent87b46e166350548b518074a65ab2492825992fc0 (diff)
downloadNetworkManager-a019d965f72e1f8d59413f2df9e8d94cdfff84db.tar.gz
core: avoid creating devcon data that we don't need
Otherwise, we create device × profiles entries, most of them nonsensical.
-rw-r--r--src/core/nm-manager.c11
-rw-r--r--src/core/nm-policy.c10
2 files changed, 15 insertions, 6 deletions
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index 46adfd356b..6d8245c7d8 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -1456,7 +1456,11 @@ nm_manager_devcon_autoconnect_retries_blocked_until(NMManager *self,
nm_assert(NM_IS_SETTINGS_CONNECTION(sett_conn));
if (device) {
- data = _devcon_lookup_data(self, device, sett_conn, TRUE, TRUE);
+ data = _devcon_lookup_data(self, device, sett_conn, FALSE, FALSE);
+
+ if (!data)
+ return 0;
+
return data->autoconnect.blocked_until_sec;
}
@@ -1487,7 +1491,10 @@ nm_manager_devcon_autoconnect_is_blocked(NMManager *self,
if (nm_settings_connection_autoconnect_is_blocked(sett_conn))
return TRUE;
- data = _devcon_lookup_data(self, device, sett_conn, TRUE, TRUE);
+ data = _devcon_lookup_data(self, device, sett_conn, FALSE, FALSE);
+
+ if (!data)
+ return FALSE;
if (data->autoconnect.blocked_reason != NM_SETTINGS_AUTOCONNECT_BLOCKED_REASON_NONE)
return TRUE;
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
index ae2c15f22a..7a4cab1d21 100644
--- a/src/core/nm-policy.c
+++ b/src/core/nm-policy.c
@@ -1758,11 +1758,13 @@ _connection_autoconnect_retries_set(NMPolicy *self,
if (tries == 0) {
/* Schedule a handler to reset retries count */
if (!priv->reset_connections_retries_idle_source) {
- gint32 retry_time = nm_manager_devcon_autoconnect_retries_blocked_until(priv->manager,
- device,
- connection);
+ gint32 retry_time;
+
+ retry_time = nm_manager_devcon_autoconnect_retries_blocked_until(priv->manager,
+ device,
+ connection);
+ nm_assert(retry_time != 0);
- g_warn_if_fail(retry_time != 0);
priv->reset_connections_retries_idle_source = nm_g_timeout_add_seconds_source(
MAX(0, retry_time - nm_utils_get_monotonic_timestamp_sec()),
reset_connections_retries,