summary refs log tree commit diff
path: root/src/core
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2024-07-26 01:21:35 +0200
committerMichael Biebl <biebl@debian.org>2024-07-26 01:21:35 +0200
commit45a364c60a9d6d34e614c4f1f507c69336ad1e69 (patch)
treee19f6be7be473589a493b2e7888e5eb2c28dad43 /src/core
parent58affb29b8386d6d26359da604a64fefe7ae0a60 (diff)
New upstream version 1.48.6 upstream/1.48.6
Diffstat (limited to 'src/core')
-rw-r--r--src/core/devices/ovs/nm-device-ovs-interface.c2
-rw-r--r--src/core/nm-active-connection.c33
-rw-r--r--src/core/nm-manager.c18
-rw-r--r--src/core/nm-policy.c2
4 files changed, 38 insertions, 17 deletions
diff --git a/src/core/devices/ovs/nm-device-ovs-interface.c b/src/core/devices/ovs/nm-device-ovs-interface.c
index 778f230b..c83451de 100644
--- a/src/core/devices/ovs/nm-device-ovs-interface.c
+++ b/src/core/devices/ovs/nm-device-ovs-interface.c
@@ -155,6 +155,8 @@ check_waiting_for_link(NMDevice *device, const char *from)
         reason = "no ifindex";
     } else if (!(pllink = nm_platform_link_get(platform, ip_ifindex))) {
         reason = "platform link not found";
+    } else if (!pllink->initialized) {
+        reason = "link is not ready yet";
     } else if (priv->wait_link.cloned_mac
                && !nm_utils_hwaddr_matches(priv->wait_link.cloned_mac,
                                            -1,
diff --git a/src/core/nm-active-connection.c b/src/core/nm-active-connection.c
index 7d89251c..fd345495 100644
--- a/src/core/nm-active-connection.c
+++ b/src/core/nm-active-connection.c
@@ -871,20 +871,28 @@ nm_active_connection_set_controller(NMActiveConnection *self, NMActiveConnection
 
     priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self);
 
-    /* Controller is write-once, and must be set before exporting the object */
-    g_return_if_fail(priv->controller == NULL);
-    g_return_if_fail(!nm_dbus_object_is_exported(NM_DBUS_OBJECT(self)));
+    if (priv->controller != NULL) {
+        _LOGD("releasing previous controller " NM_HASH_OBFUSCATE_PTR_FMT " %s, state %s",
+              NM_HASH_OBFUSCATE_PTR(priv->controller),
+              nm_active_connection_get_settings_connection_id(priv->controller),
+              state_to_string_a(nm_active_connection_get_state(priv->controller)));
+        g_clear_object(&priv->controller);
+    }
+
     if (priv->device) {
         /* Note, the master ActiveConnection may not yet have a device */
         g_return_if_fail(priv->device != nm_active_connection_get_device(controller));
     }
 
-    _LOGD("set controller %p, %s, state %s",
-          controller,
+    _LOGD("set controller " NM_HASH_OBFUSCATE_PTR_FMT ", %s, state %s",
+          NM_HASH_OBFUSCATE_PTR(controller),
           nm_active_connection_get_settings_connection_id(controller),
           state_to_string_a(nm_active_connection_get_state(controller)));
 
     priv->controller = g_object_ref(controller);
+
+    _notify(self, PROP_CONTROLLER);
+
     g_signal_connect(priv->controller,
                      "notify::" NM_ACTIVE_CONNECTION_STATE,
                      G_CALLBACK(master_state_cb),
@@ -903,15 +911,20 @@ nm_active_connection_set_controller_dev(NMActiveConnection *self, NMDevice *cont
 
     priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self);
 
-    /* Controller device is write-once, and must be set before exporting the object */
-    g_return_if_fail(priv->controller_dev == NULL);
-    g_return_if_fail(!nm_dbus_object_is_exported(NM_DBUS_OBJECT(self)));
+    if (priv->controller_dev != NULL) {
+        _LOGD("releasing previous controller device " NM_HASH_OBFUSCATE_PTR_FMT " %s(%s), state %s",
+              NM_HASH_OBFUSCATE_PTR(priv->controller_dev),
+              nm_device_get_iface(priv->controller_dev),
+              nm_device_get_type_desc(priv->controller_dev),
+              nm_device_state_to_string(nm_device_get_state(priv->controller_dev)));
+        g_clear_object(&priv->controller_dev);
+    }
     if (priv->device) {
         g_return_if_fail(priv->device != controller_dev);
     }
 
-    _LOGD("set controller device %p, %s(%s), state %s",
-          controller_dev,
+    _LOGD("set controller device " NM_HASH_OBFUSCATE_PTR_FMT ", %s(%s), state %s",
+          NM_HASH_OBFUSCATE_PTR(controller_dev),
           nm_device_get_iface(controller_dev),
           nm_device_get_type_desc(controller_dev),
           nm_device_state_to_string(nm_device_get_state(controller_dev)));
diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c
index ddbd2021..e949ea11 100644
--- a/src/core/nm-manager.c
+++ b/src/core/nm-manager.c
@@ -5953,15 +5953,21 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError **
             && (nm_device_get_state_reason(master_device)
                 == NM_DEVICE_STATE_REASON_NEW_ACTIVATION)) {
             nm_active_connection_set_controller_dev(active, master_device);
+            _LOGD(LOGD_CORE,
+                  "Activation of '%s'(%s) depends on controller device %p %s",
+                  nm_settings_connection_get_id(sett_conn),
+                  nm_settings_connection_get_connection_type(sett_conn),
+                  master_device,
+                  nm_dbus_object_get_path(NM_DBUS_OBJECT(master_device)) ?: "");
         } else {
             nm_active_connection_set_controller(active, master_ac);
+            _LOGD(LOGD_CORE,
+                  "Activation of '%s'(%s) depends on active connection %p %s",
+                  nm_settings_connection_get_id(sett_conn),
+                  nm_settings_connection_get_connection_type(sett_conn),
+                  master_ac,
+                  nm_dbus_object_get_path(NM_DBUS_OBJECT(master_ac)) ?: "");
         }
-
-        _LOGD(LOGD_CORE,
-              "Activation of '%s' depends on active connection %p %s",
-              nm_settings_connection_get_id(sett_conn),
-              master_ac,
-              nm_dbus_object_get_path(NM_DBUS_OBJECT(master_ac)) ?: "");
     }
 
     /* Check slaves for master connection and possibly activate them */
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
index 60d11c75..4b8262f7 100644
--- a/src/core/nm-policy.c
+++ b/src/core/nm-policy.c
@@ -2934,7 +2934,7 @@ dispose(GObject *object)
     NMPolicy        *self = NM_POLICY(object);
     NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self);
 
-    nm_assert(!c_list_is_empty(&priv->policy_auto_activate_lst_head));
+    nm_assert(c_list_is_empty(&priv->policy_auto_activate_lst_head));
     nm_assert(g_hash_table_size(priv->devices) == 0);
 
     nm_clear_g_object(&priv->default_ac4);