diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-09-11 10:57:07 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-10-10 15:08:16 +0200 |
commit | 6455a4e52852a936ae34e6596a2d309a44fb8fcc (patch) | |
tree | f97e2aa418d0e1769128f9949a0c6c73c113a322 | |
parent | 353c7c95c1c664c024c4267e67ed2d4b57b44437 (diff) | |
download | NetworkManager-6455a4e52852a936ae34e6596a2d309a44fb8fcc.tar.gz |
device: expand comment on MTU selection
-rw-r--r-- | src/devices/nm-device.c | 18 |
1 files changed, 15 insertions, 3 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index 09241d8ffb..440a94c238 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -9376,9 +9376,21 @@ _commit_mtu (NMDevice *self, const NMIP4Config *config) { guint32 mtu = 0; - /* preferably, get the MTU from explicit user-configuration. - * Only if that fails, look at the current @config (which contains - * MTUs from DHCP/PPP) or maybe fallback to a device-specific MTU. */ + /* We take the MTU from various sources: (in order of increasing + * priority) parent link, IP configuration (which contains the + * MTU from DHCP/PPP), connection profile. + * + * We could just compare it with the platform MTU and apply it + * when different, but this would revert at random times manual + * changes done by the user with the MTU from the connection. + * + * Instead, we remember the source of the currently configured + * MTU and apply the new one only when the new source has a + * higher priority, so that we don't set a MTU from same source + * multiple times. An exception to this is for the PARENT + * source, since we need to keep tracking the parent MTU when it + * changes. + */ if (NM_DEVICE_GET_CLASS (self)->get_configured_mtu) mtu = NM_DEVICE_GET_CLASS (self)->get_configured_mtu (self, &source); |