From 3246185a3fd62f2149c274a5ec07aa3d23d5691c Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Fri, 31 May 2024 01:14:21 +0200 Subject: [PATCH] Upgrade to 1.48 Resolves: RHEL-35539 Resolves: RHEL-31972 --- .gitignore | 1 + ...ort-reactivation-when-controller-is-.patch | 213 ++++++++++++++++++ NetworkManager.spec | 6 +- sources | 2 +- 4 files changed, 220 insertions(+), 2 deletions(-) create mode 100644 0001-checkpoint-fix-port-reactivation-when-controller-is-.patch diff --git a/.gitignore b/.gitignore index 577942d..d7defb3 100644 --- a/.gitignore +++ b/.gitignore @@ -457,3 +457,4 @@ network-manager-applet-0.8.1.tar.bz2 /NetworkManager-1.47.5.tar.xz /NetworkManager-1.47.90.tar.xz /NetworkManager-1.47.91.tar.xz +/NetworkManager-1.48.0.tar.xz diff --git a/0001-checkpoint-fix-port-reactivation-when-controller-is-.patch b/0001-checkpoint-fix-port-reactivation-when-controller-is-.patch new file mode 100644 index 0000000..94f19a2 --- /dev/null +++ b/0001-checkpoint-fix-port-reactivation-when-controller-is-.patch @@ -0,0 +1,213 @@ +From 4726822fb05d846ee402ce5e2c139dfb6c5a8ca3 Mon Sep 17 00:00:00 2001 +From: Gris Ge +Date: Tue, 14 May 2024 11:39:21 +0800 +Subject: [PATCH] checkpoint: fix port reactivation when controller is + deactivating + +Problem: + + Given a OVS port with `autoconnect-ports` set to default or false, + when reactivation required for checkpoint rollback, + previous activated OVS interface will be in deactivate state after + checkpoint rollback. + +The root cause: + + The `activate_stage1_device_prepare()` will mark the device as + failed when controller is deactivating or deactivated. + In `activate_stage1_device_prepare()`, the controller device is + retrieved from NMActiveConnection, it will be NULL when NMActiveConnection + is in deactivated state. This will cause device been set to + `NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED` which prevent all follow + up `autoconnect` actions. + +Fix: + When noticing controller is deactivating or deactivated with reason + `NM_DEVICE_STATE_REASON_NEW_ACTIVATION`, use new function + `nm_active_connection_set_controller_dev()` to wait on controller + device state between NM_DEVICE_STATE_PREPARE and + NM_DEVICE_STATE_ACTIVATED. After that, use existing + `nm_active_connection_set_controller()` to use new + NMActiveConnection of controller to move on. + +Resolves: https://issues.redhat.com/browse/RHEL-31972 + +Signed-off-by: Gris Ge +(cherry picked from commit a68d2fd7807b8c6f976c45ffa29835b7f8f470ca) +--- + src/core/devices/nm-device.c | 8 +++++ + src/core/devices/nm-device.h | 3 +- + src/core/nm-active-connection.c | 62 +++++++++++++++++++++++++++++++++ + src/core/nm-active-connection.h | 1 + + src/core/nm-manager.c | 15 +++++++- + 5 files changed, 87 insertions(+), 2 deletions(-) + +diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c +index b96adefbd0..f3441508ab 100644 +--- a/src/core/devices/nm-device.c ++++ b/src/core/devices/nm-device.c +@@ -17205,6 +17205,14 @@ nm_device_get_state(NMDevice *self) + return NM_DEVICE_GET_PRIVATE(self)->state; + } + ++NMDeviceStateReason ++nm_device_get_state_reason(NMDevice *self) ++{ ++ g_return_val_if_fail(NM_IS_DEVICE(self), NM_DEVICE_STATE_REASON_NONE); ++ ++ return NM_DEVICE_GET_PRIVATE(self)->state_reason; ++} ++ + /*****************************************************************************/ + + /** +diff --git a/src/core/devices/nm-device.h b/src/core/devices/nm-device.h +index ffe6b1af99..ba45497ce2 100644 +--- a/src/core/devices/nm-device.h ++++ b/src/core/devices/nm-device.h +@@ -561,7 +561,8 @@ int nm_device_spec_match_list_full(NMDevice *self, const GSList *specs, int + gboolean nm_device_is_activating(NMDevice *dev); + gboolean nm_device_autoconnect_allowed(NMDevice *self); + +-NMDeviceState nm_device_get_state(NMDevice *device); ++NMDeviceState nm_device_get_state(NMDevice *device); ++NMDeviceStateReason nm_device_get_state_reason(NMDevice *device); + + gboolean nm_device_get_enabled(NMDevice *device); + +diff --git a/src/core/nm-active-connection.c b/src/core/nm-active-connection.c +index b08d26c28b..7d89251caa 100644 +--- a/src/core/nm-active-connection.c ++++ b/src/core/nm-active-connection.c +@@ -50,6 +50,7 @@ typedef struct _NMActiveConnectionPrivate { + + NMAuthSubject *subject; + NMActiveConnection *controller; ++ NMDevice *controller_dev; + + NMActiveConnection *parent; + +@@ -826,6 +827,31 @@ master_state_cb(NMActiveConnection *master, GParamSpec *pspec, gpointer user_dat + } + } + ++static void ++controller_dev_state_cb(NMDevice *controller_dev, ++ NMDeviceState new_state, ++ NMDeviceState old_state, ++ NMDeviceStateReason reason, ++ gpointer user_data) ++{ ++ NMActiveConnection *self = NM_ACTIVE_CONNECTION(user_data); ++ NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self); ++ NMActRequest *controller_act_request; ++ NMActiveConnection *controller_ac; ++ ++ if (new_state >= NM_DEVICE_STATE_PREPARE && new_state <= NM_DEVICE_STATE_ACTIVATED) { ++ controller_act_request = nm_device_get_act_request(controller_dev); ++ if (controller_act_request) { ++ controller_ac = NM_ACTIVE_CONNECTION(controller_act_request); ++ g_signal_handlers_disconnect_by_func(controller_dev, ++ G_CALLBACK(controller_dev_state_cb), ++ self); ++ g_clear_object(&priv->controller_dev); ++ nm_active_connection_set_controller(self, controller_ac); ++ } ++ } ++} ++ + /** + * nm_active_connection_set_controller: + * @self: the #NMActiveConnection +@@ -867,6 +893,36 @@ nm_active_connection_set_controller(NMActiveConnection *self, NMActiveConnection + check_controller_ready(self); + } + ++void ++nm_active_connection_set_controller_dev(NMActiveConnection *self, NMDevice *controller_dev) ++{ ++ NMActiveConnectionPrivate *priv; ++ ++ g_return_if_fail(NM_IS_ACTIVE_CONNECTION(self)); ++ g_return_if_fail(NM_IS_DEVICE(controller_dev)); ++ ++ 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->device) { ++ g_return_if_fail(priv->device != controller_dev); ++ } ++ ++ _LOGD("set controller device %p, %s(%s), state %s", ++ 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))); ++ ++ priv->controller_dev = g_object_ref(controller_dev); ++ g_signal_connect(priv->controller_dev, ++ NM_DEVICE_STATE_CHANGED, ++ G_CALLBACK(controller_dev_state_cb), ++ self); ++} ++ + NMActivationType + nm_active_connection_get_activation_type(NMActiveConnection *self) + { +@@ -1533,7 +1589,13 @@ dispose(GObject *object) + if (priv->controller) { + g_signal_handlers_disconnect_by_func(priv->controller, G_CALLBACK(master_state_cb), self); + } ++ if (priv->controller_dev) { ++ g_signal_handlers_disconnect_by_func(priv->controller_dev, ++ G_CALLBACK(controller_dev_state_cb), ++ self); ++ } + g_clear_object(&priv->controller); ++ g_clear_object(&priv->controller_dev); + + if (priv->parent) + unwatch_parent(self, TRUE); +diff --git a/src/core/nm-active-connection.h b/src/core/nm-active-connection.h +index 12cb311c97..ba32830257 100644 +--- a/src/core/nm-active-connection.h ++++ b/src/core/nm-active-connection.h +@@ -175,6 +175,7 @@ NMActiveConnection *nm_active_connection_get_controller(NMActiveConnection *self + gboolean nm_active_connection_get_controller_ready(NMActiveConnection *self); + + void nm_active_connection_set_controller(NMActiveConnection *self, NMActiveConnection *controller); ++void nm_active_connection_set_controller_dev(NMActiveConnection *self, NMDevice *controller_dev); + + void nm_active_connection_set_parent(NMActiveConnection *self, NMActiveConnection *parent); + +diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c +index b2a827e38b..2c2834e9fc 100644 +--- a/src/core/nm-manager.c ++++ b/src/core/nm-manager.c +@@ -5943,7 +5943,20 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** + NM_DEVICE_STATE_REASON_USER_REQUESTED); + } + +- nm_active_connection_set_controller(active, master_ac); ++ /* If controller NMActiveConnection is deactivating, we should wait on ++ * controller's NMDevice to have new NMActiveConnection after ++ * controller device state change to between NM_DEVICE_STATE_PREPARE and ++ * NM_DEVICE_STATE_ACTIVATED. ++ */ ++ if ((nm_active_connection_get_state(master_ac) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) ++ && master_device ++ && (nm_device_get_state_reason(master_device) ++ == NM_DEVICE_STATE_REASON_NEW_ACTIVATION)) { ++ nm_active_connection_set_controller_dev(active, master_device); ++ } else { ++ nm_active_connection_set_controller(active, master_ac); ++ } ++ + _LOGD(LOGD_CORE, + "Activation of '%s' depends on active connection %p %s", + nm_settings_connection_get_id(sett_conn), +-- +2.45.1 + diff --git a/NetworkManager.spec b/NetworkManager.spec index 12e2c85..767418c 100644 --- a/NetworkManager.spec +++ b/NetworkManager.spec @@ -4,7 +4,7 @@ %global glib2_version %(pkg-config --modversion glib-2.0 2>/dev/null || echo bad) %global epoch_version 1 -%global real_version 1.47.91 +%global real_version 1.48.0 %global rpm_version %{real_version} %global release_version 1 %global snapshot %{nil} @@ -212,6 +212,7 @@ Patch0001: 0001-revert-change-default-value-for-ipv4.dad-timeout-from-0-to-200ms # Bugfixes that are only relevant until next rebase of the package. # Patch1001: 1001-some.patch +Patch1001: 0001-checkpoint-fix-port-reactivation-when-controller-is-.patch Requires(post): systemd %if 0%{?fedora} || 0%{?rhel} >= 8 @@ -1267,6 +1268,9 @@ fi %changelog +* Thu May 30 2024 Lubomir Rintel - 1:1.48.0-1 +- Upgrade to 1.48.0 release + * Thu May 16 2024 Lubomir Rintel - 1:1.47.91-1 - Upgrade to 1.47.91 (rc2) diff --git a/sources b/sources index 2d0b562..107cb93 100644 --- a/sources +++ b/sources @@ -1 +1 @@ -SHA512 (NetworkManager-1.47.91.tar.xz) = 83c536e57a6092ece636cb7b73385465782a7f2da34517b0fb151bcb080443a2c3ccf33cb88434df550b15249499365cdd9837de31c82ad874dd5a494e0ac62d +SHA512 (NetworkManager-1.48.0.tar.xz) = 96fa39924df9b14e56c6b3338e554345ec3cdcc39032e052686cfb2e7d4817311718c3e69bf344aebcfffea6ddec0fcf7ebfbae2e49738a5f04a6e53a8ec6c6d