Blame SOURCES/1007-core-no-warn-setting-mtu-with-ipv6-disabled-rh1840989.patch

f25c7b
From 7aa3b439df293b16597df3a0a2baa6caf3bb1322 Mon Sep 17 00:00:00 2001
f25c7b
From: Beniamino Galvani <bgalvani@redhat.com>
f25c7b
Date: Thu, 23 Jul 2020 17:18:56 +0200
f25c7b
Subject: [PATCH 1/1] device: downgrade warning about IPv6 MTU if IPv6 is
f25c7b
 disabled
f25c7b
f25c7b
If IPv6 is disabled, changing the IPv6 MTU fails and NM complains with
f25c7b
a warning. Since this error is expected and doesn't do any harm,
f25c7b
downgrade the logging level to DEBUG.
f25c7b
f25c7b
Since IPv6 kernel support can be built as a module, we have to check
f25c7b
the existence of /proc/sys/net/ipv6 every time. Instead of checking it
f25c7b
and then setting the MTU (adding one /proc access for everyone), just try
f25c7b
to set the MTU; in case of failure, determine the reason for the error.
f25c7b
f25c7b
https://bugzilla.redhat.com/show_bug.cgi?id=1840989
f25c7b
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/585
f25c7b
(cherry picked from commit 9c09dcedafd51da65c04669b830bc9652000d462)
f25c7b
(cherry picked from commit ce3dffd24eb21924a332794bc66705dbd6c052a2)
f25c7b
---
f25c7b
 src/devices/nm-device.c | 23 +++++++++++++++++------
f25c7b
 1 file changed, 17 insertions(+), 6 deletions(-)
f25c7b
f25c7b
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
f25c7b
index 57c32cef8f09..24209c8614f1 100644
f25c7b
--- a/src/devices/nm-device.c
f25c7b
+++ b/src/devices/nm-device.c
f25c7b
@@ -10268,14 +10268,25 @@ _commit_mtu (NMDevice *self, const NMIP4Config *config)
f25c7b
 			if (!nm_device_sysctl_ip_conf_set (self, AF_INET6, "mtu",
f25c7b
 			                                   nm_sprintf_buf (sbuf, "%u", (unsigned) ip6_mtu))) {
f25c7b
 				int errsv = errno;
f25c7b
+				NMLogLevel level = LOGL_WARN;
f25c7b
+				const char *msg = NULL;
f25c7b
 
f25c7b
-				_NMLOG (anticipated_failure && errsv == EINVAL ? LOGL_DEBUG : LOGL_WARN,
f25c7b
-				        LOGD_DEVICE,
f25c7b
-				        "mtu: failure to set IPv6 MTU%s",
f25c7b
-				        anticipated_failure && errsv == EINVAL
f25c7b
-				           ? ": Is the underlying MTU value successfully set?"
f25c7b
-				           : "");
f25c7b
 				success = FALSE;
f25c7b
+
f25c7b
+				if (anticipated_failure && errsv == EINVAL) {
f25c7b
+					level = LOGL_DEBUG;
f25c7b
+					msg = "Is the underlying MTU value successfully set?";
f25c7b
+				} else if (!g_file_test ("/proc/sys/net/ipv6", G_FILE_TEST_IS_DIR)) {
f25c7b
+					level = LOGL_DEBUG;
f25c7b
+					msg = "IPv6 is disabled";
f25c7b
+					success = TRUE;
f25c7b
+				}
f25c7b
+
f25c7b
+				_NMLOG (level,
f25c7b
+				        LOGD_DEVICE,
f25c7b
+				        "mtu: failure to set IPv6 MTU%s%s",
f25c7b
+				        msg ? ": " : "",
f25c7b
+				        msg ?: "");
f25c7b
 			}
f25c7b
 			priv->carrier_wait_until_ms = nm_utils_get_monotonic_timestamp_msec () + CARRIER_WAIT_TIME_AFTER_MTU_MS;
f25c7b
 		}
f25c7b
-- 
f25c7b
2.26.2
f25c7b