summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2020-07-23 17:18:56 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2020-07-24 13:41:31 +0200
commit9c09dcedafd51da65c04669b830bc9652000d462 (patch)
tree3bbead4c0507b656eb79d64244090a9ab55171cc
parentcb73d0b1e29cd96213654f245022a80d42be56a2 (diff)
downloadNetworkManager-9c09dcedafd51da65c04669b830bc9652000d462.tar.gz
device: downgrade warning about IPv6 MTU if IPv6 is disabled
If IPv6 is disabled, changing the IPv6 MTU fails and NM complains with a warning. Since this error is expected and doesn't do any harm, downgrade the logging level to DEBUG. Since IPv6 kernel support can be built as a module, we have to check the existence of /proc/sys/net/ipv6 every time. Instead of checking it and then setting the MTU (adding one /proc access for everyone), just try to set the MTU; in case of failure, determine the reason for the error. https://bugzilla.redhat.com/show_bug.cgi?id=1840989 https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/585
-rw-r--r--src/devices/nm-device.c23
1 files changed, 17 insertions, 6 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
index e3d7ae3d46..91b0edfd50 100644
--- a/src/devices/nm-device.c
+++ b/src/devices/nm-device.c
@@ -10321,14 +10321,25 @@ _commit_mtu (NMDevice *self, const NMIP4Config *config)
if (!nm_device_sysctl_ip_conf_set (self, AF_INET6, "mtu",
nm_sprintf_buf (sbuf, "%u", (unsigned) ip6_mtu))) {
int errsv = errno;
+ NMLogLevel level = LOGL_WARN;
+ const char *msg = NULL;
- _NMLOG (anticipated_failure && errsv == EINVAL ? LOGL_DEBUG : LOGL_WARN,
- LOGD_DEVICE,
- "mtu: failure to set IPv6 MTU%s",
- anticipated_failure && errsv == EINVAL
- ? ": Is the underlying MTU value successfully set?"
- : "");
success = FALSE;
+
+ if (anticipated_failure && errsv == EINVAL) {
+ level = LOGL_DEBUG;
+ msg = "Is the underlying MTU value successfully set?";
+ } else if (!g_file_test ("/proc/sys/net/ipv6", G_FILE_TEST_IS_DIR)) {
+ level = LOGL_DEBUG;
+ msg = "IPv6 is disabled";
+ success = TRUE;
+ }
+
+ _NMLOG (level,
+ LOGD_DEVICE,
+ "mtu: failure to set IPv6 MTU%s%s",
+ msg ? ": " : "",
+ msg ?: "");
}
priv->carrier_wait_until_ms = nm_utils_get_monotonic_timestamp_msec () + CARRIER_WAIT_TIME_AFTER_MTU_MS;
}