diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2019-12-05 15:39:56 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2019-12-05 17:22:53 +0100 |
commit | 9a0993abe157f5f130b77b52b6ab80dcb3157bcf (patch) | |
tree | c1d140a32db1ad8b920e4839d2165baafc31fcb3 | |
parent | 6943718822b479656a4689dbfacbee8d73c48496 (diff) | |
download | NetworkManager-bg/mtu-reapply-rh1779162.tar.gz |
device: always allow reapply of MTU from wired settingbg/mtu-reapply-rh1779162
Many device types take the MTU value from the wired setting; usually
they don't implement the can_reapply_change() method and so the MTU
can't be changed with the Reapply() API.
Instead of implementing the method for all such devices to support the
same property (adding a lot of duplicated code), add a check in
NMDevice to allow the reapply of MTU when we recognize that the device
uses the MTU from the wired setting.
Device types can still decide to implement can_reapply_change() and
support whatever properties they want, even from the wired setting.
-rw-r--r-- | src/devices/nm-device.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/devices/nm-device.c b/src/devices/nm-device.c index c50aa42ac7..3b595938df 100644 --- a/src/devices/nm-device.c +++ b/src/devices/nm-device.c @@ -11752,6 +11752,14 @@ can_reapply_change (NMDevice *self, NM_SETTING_IP4_CONFIG_SETTING_NAME, NM_SETTING_IP6_CONFIG_SETTING_NAME)) { return TRUE; + } else if ( nm_streq (setting_name, NM_SETTING_WIRED_SETTING_NAME) + && NM_IN_SET (NM_DEVICE_GET_CLASS (self)->get_configured_mtu, + nm_device_get_configured_mtu_wired_parent, + nm_device_get_configured_mtu_for_wired)) { + return nm_device_hash_check_invalid_keys (diffs, + NM_SETTING_WIRED_SETTING_NAME, + error, + NM_SETTING_WIRED_MTU); } else { g_set_error (error, NM_DEVICE_ERROR, |