Blame SOURCES/1010-core-update-DNS-when-the-device-enters-IP_CONFIG-rh2100456.patch

f817d2
From 0e0cd7342ae5b2f561e364c3c085d6378e7b24cb Mon Sep 17 00:00:00 2001
f817d2
From: Beniamino Galvani <bgalvani@redhat.com>
f817d2
Date: Fri, 1 Jul 2022 13:42:26 +0200
f817d2
Subject: [PATCH] core: update DNS when the device enters IP_CONFIG state
f817d2
f817d2
Update DNS information when the device enters the IP_CONFIG state. In
f817d2
this way, when dispatcher events "dhcp4-change,dhcp6-change" are
f817d2
emitted resolv.conf already contains the information received from
f817d2
the DHCP lease.
f817d2
f817d2
https://bugzilla.redhat.com/show_bug.cgi?id=2100456
f817d2
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1283
f817d2
(cherry picked from commit 1784fc9fa15391043959ca684569c9cb816f44c5)
f817d2
(cherry picked from commit 95df70112f513d44fec1ea3f7fe22a03b4f9651e)
f817d2
(cherry picked from commit ace95e51130b41f39785358bf955b7086bb41c1e)
f817d2
---
f817d2
 src/core/nm-policy.c | 17 ++++++-----------
f817d2
 1 file changed, 6 insertions(+), 11 deletions(-)
f817d2
f817d2
diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c
f817d2
index d77fc0a025..c8971d4b6d 100644
f817d2
--- a/src/core/nm-policy.c
f817d2
+++ b/src/core/nm-policy.c
f817d2
@@ -2131,19 +2131,14 @@ device_l3cd_changed(NMDevice             *device,
f817d2
 
f817d2
     nm_dns_manager_begin_updates(priv->dns_manager, __func__);
f817d2
 
f817d2
-    /* We catch already all the IP events registering on the device state changes but
f817d2
-     * the ones where the IP changes with a stable state (i.e., activated):
f817d2
-     * ignore IP config changes but when the device is in activated state.
f817d2
-     * Prevents unnecessary changes to DNS information.
f817d2
-     * FIXME(l3cfg): check why ^^^ this is needed and implement it. Note that
f817d2
-     * this function is not always called when the device becomes ACTIVATED.
f817d2
-     * Previously, we would also update the DNS manager's IP config in
f817d2
-     * device_state_change(ACTIVATED). There we would also special-case
f817d2
-     * pseudo-VPNs like wireguard. I don't see the code where this is handled
f817d2
-     * now.
f817d2
+    /* FIXME(l3cfg): Note that this function is not always called when the
f817d2
+     * device becomes ACTIVATED. Previously, we would also update the DNS
f817d2
+     * manager's IP config in device_state_change(ACTIVATED). There we would
f817d2
+     * also special-case pseudo-VPNs like wireguard. I don't see the code where
f817d2
+     * this is handled now.
f817d2
      */
f817d2
     state = nm_device_get_state(device);
f817d2
-    if (l3cd_new && state > NM_DEVICE_STATE_IP_CONFIG && state < NM_DEVICE_STATE_DEACTIVATING) {
f817d2
+    if (l3cd_new && state >= NM_DEVICE_STATE_IP_CONFIG && state < NM_DEVICE_STATE_DEACTIVATING) {
f817d2
         nm_dns_manager_set_ip_config(priv->dns_manager,
f817d2
                                      AF_UNSPEC,
f817d2
                                      device,
f817d2
-- 
f817d2
2.36.1
f817d2