Blame SOURCES/0030-device-mtu-preserve-rh1460760.patch

fc9aca
From a222f7e0554fe8057a6d9c6749acbd066798fa9d Mon Sep 17 00:00:00 2001
fc9aca
From: Thomas Haller <thaller@redhat.com>
fc9aca
Date: Tue, 13 Jun 2017 12:26:51 +0200
fc9aca
Subject: [PATCH 1/1] device: don't set MTU of device unless explicitly
fc9aca
 configured
fc9aca
fc9aca
Since commit 2b51d3967 "device: merge branch 'th/device-mtu-bgo777251'",
fc9aca
we always set the MTU for certain device types during activation. Even
fc9aca
if the MTU is neither specified via the connection nor other means, like
fc9aca
DHCP.
fc9aca
fc9aca
Revert that change. On activation, if nothing explicitly configures the
fc9aca
MTU, leave it unchanged. This is like what we do with ethernet's
fc9aca
cloned-mac-address, which has a default value "preserve".
fc9aca
So, as last resort the default value for MTU is now 0 (don't change),
fc9aca
instead of depending on the device type.
fc9aca
fc9aca
Note that you also can override the default value in global
fc9aca
configuration via NetworkManager.conf.
fc9aca
fc9aca
This behavior makes sense, because whenever NM actively resets the MTU,
fc9aca
it remembers the previous value and restores it when deactivating
fc9aca
the connection. That wasn't implemented before 2b51d3967, and the
fc9aca
MTU would depend on which connection was previously active. That
fc9aca
is no longer an issue as the MTU gets reset when deactivating.
fc9aca
fc9aca
https://bugzilla.redhat.com/show_bug.cgi?id=1460760
fc9aca
(cherry picked from commit 4ca3002b86948847711cd5b1937008baef3c30da)
fc9aca
(cherry picked from commit 588841f2e086774420a7ff4452d87e45ffae578a)
fc9aca
---
fc9aca
 man/NetworkManager.conf.xml        | 2 +-
fc9aca
 src/devices/nm-device-infiniband.c | 2 +-
fc9aca
 src/devices/nm-device-ip-tunnel.c  | 2 +-
fc9aca
 src/devices/nm-device-private.h    | 4 ----
fc9aca
 src/devices/nm-device-vlan.c       | 2 +-
fc9aca
 src/devices/nm-device.c            | 2 +-
fc9aca
 src/devices/wifi/nm-device-wifi.c  | 2 +-
fc9aca
 7 files changed, 6 insertions(+), 10 deletions(-)
fc9aca
fc9aca
diff --git a/man/NetworkManager.conf.xml b/man/NetworkManager.conf.xml
fc9aca
index 5e76c0ace..71c62cc15 100644
fc9aca
--- a/man/NetworkManager.conf.xml
fc9aca
+++ b/man/NetworkManager.conf.xml
fc9aca
@@ -655,7 +655,7 @@ ipv6.ip6-privacy=0
fc9aca
         </varlistentry>
fc9aca
         <varlistentry>
fc9aca
           <term><varname>ethernet.mtu</varname></term>
fc9aca
-          <listitem><para>If configured explicitly to 0, the MTU is not reconfigured during device activation unless it is required due to IPv6 constraints. If left unspecified, a DHCP/IPv6 SLAAC provided value is used or a default of 1500.</para></listitem>
fc9aca
+          <listitem><para>If configured explicitly to 0, the MTU is not reconfigured during device activation unless it is required due to IPv6 constraints. If left unspecified, a DHCP/IPv6 SLAAC provided value is used or the MTU is not reconfigured during activation.</para></listitem>
fc9aca
         </varlistentry>
fc9aca
         <varlistentry>
fc9aca
           <term><varname>ethernet.wake-on-lan</varname></term>
fc9aca
diff --git a/src/devices/nm-device-infiniband.c b/src/devices/nm-device-infiniband.c
fc9aca
index f7875d099..7e0412703 100644
fc9aca
--- a/src/devices/nm-device-infiniband.c
fc9aca
+++ b/src/devices/nm-device-infiniband.c
fc9aca
@@ -139,7 +139,7 @@ get_configured_mtu (NMDevice *device, gboolean *out_is_user_config)
fc9aca
 		}
fc9aca
 	}
fc9aca
 	*out_is_user_config = (mtu != 0);
fc9aca
-	return mtu ?: NM_DEVICE_DEFAULT_MTU_INFINIBAND;
fc9aca
+	return mtu;
fc9aca
 }
fc9aca
 
fc9aca
 static gboolean
fc9aca
diff --git a/src/devices/nm-device-ip-tunnel.c b/src/devices/nm-device-ip-tunnel.c
fc9aca
index 53b7cf4e5..2f505ef4c 100644
fc9aca
--- a/src/devices/nm-device-ip-tunnel.c
fc9aca
+++ b/src/devices/nm-device-ip-tunnel.c
fc9aca
@@ -767,7 +767,7 @@ get_configured_mtu (NMDevice *self, gboolean *out_is_user_config)
fc9aca
 		}
fc9aca
 	}
fc9aca
 	*out_is_user_config = (mtu != 0);
fc9aca
-	return mtu ?: NM_DEVICE_DEFAULT_MTU_WIRED;
fc9aca
+	return mtu;
fc9aca
 }
fc9aca
 
fc9aca
 static NMDeviceCapabilities
fc9aca
diff --git a/src/devices/nm-device-private.h b/src/devices/nm-device-private.h
fc9aca
index a4067f9c2..9eccafdc6 100644
fc9aca
--- a/src/devices/nm-device-private.h
fc9aca
+++ b/src/devices/nm-device-private.h
fc9aca
@@ -116,10 +116,6 @@ gboolean nm_device_ipv6_sysctl_set (NMDevice *self, const char *property, const
fc9aca
 
fc9aca
 /*****************************************************************************/
fc9aca
 
fc9aca
-#define NM_DEVICE_DEFAULT_MTU_WIRED          ((guint32) 1500)
fc9aca
-#define NM_DEVICE_DEFAULT_MTU_WIRELESS       ((guint32) 1500)
fc9aca
-#define NM_DEVICE_DEFAULT_MTU_INFINIBAND     ((guint32) 0)
fc9aca
-
fc9aca
 gint64 nm_device_get_configured_mtu_from_connection_default (NMDevice *self,
fc9aca
                                                              const char *property_name);
fc9aca
 
fc9aca
diff --git a/src/devices/nm-device-vlan.c b/src/devices/nm-device-vlan.c
fc9aca
index 06db64465..a74da8f22 100644
fc9aca
--- a/src/devices/nm-device-vlan.c
fc9aca
+++ b/src/devices/nm-device-vlan.c
fc9aca
@@ -586,7 +586,7 @@ get_configured_mtu (NMDevice *self, gboolean *out_is_user_config)
fc9aca
 	if (ifindex > 0)
fc9aca
 		mtu = nm_platform_link_get_mtu (nm_device_get_platform (NM_DEVICE (self)), ifindex);
fc9aca
 
fc9aca
-	return mtu ?: NM_DEVICE_DEFAULT_MTU_WIRED;
fc9aca
+	return mtu;
fc9aca
 }
fc9aca
 
fc9aca
 /*****************************************************************************/
fc9aca
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c
fc9aca
index e60995d57..e37b24bff 100644
fc9aca
--- a/src/devices/nm-device.c
fc9aca
+++ b/src/devices/nm-device.c
fc9aca
@@ -7150,7 +7150,7 @@ nm_device_get_configured_mtu_for_wired (NMDevice *self, gboolean *out_is_user_co
fc9aca
 	}
fc9aca
 
fc9aca
 	*out_is_user_config = FALSE;
fc9aca
-	return NM_DEVICE_DEFAULT_MTU_WIRED;
fc9aca
+	return 0;
fc9aca
 }
fc9aca
 
fc9aca
 /*****************************************************************************/
fc9aca
diff --git a/src/devices/wifi/nm-device-wifi.c b/src/devices/wifi/nm-device-wifi.c
fc9aca
index 7359be96e..20692ed9e 100644
fc9aca
--- a/src/devices/wifi/nm-device-wifi.c
fc9aca
+++ b/src/devices/wifi/nm-device-wifi.c
fc9aca
@@ -2742,7 +2742,7 @@ get_configured_mtu (NMDevice *device, gboolean *out_is_user_config)
fc9aca
 		}
fc9aca
 	}
fc9aca
 	*out_is_user_config = (mtu != 0);
fc9aca
-	return mtu ?: NM_DEVICE_DEFAULT_MTU_WIRELESS;
fc9aca
+	return mtu;
fc9aca
 }
fc9aca
 
fc9aca
 static gboolean
fc9aca
-- 
fc9aca
2.13.0
fc9aca