diff options
author | Francesco Giudici <fgiudici@redhat.com> | 2018-06-14 20:08:52 +0200 |
---|---|---|
committer | Francesco Giudici <fgiudici@redhat.com> | 2018-06-15 14:19:50 +0200 |
commit | 193aae91eb42ad724f38d4baeafe122d0044ee1f (patch) | |
tree | 0afc880c590733c53f0ae10c74d07b6400ab937b /src/settings/plugins | |
parent | 064ea1c58e9051491a6401c70d98aa4f727c497d (diff) | |
download | NetworkManager-193aae91eb42ad724f38d4baeafe122d0044ee1f.tar.gz |
ifcfg: enable writing/reading of speed and duplex when autoneg is enabled
Diffstat (limited to 'src/settings/plugins')
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c | 4 | ||||
-rw-r--r-- | src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c | 21 |
2 files changed, 12 insertions, 13 deletions
diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index b16cc28122..c196084638 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -4174,8 +4174,8 @@ parse_ethtool_options (shvarFile *ifcfg, NMSettingWired *s_wired, const char *va NM_SETTING_WIRED_WAKE_ON_LAN, wol_flags, NM_SETTING_WIRED_WAKE_ON_LAN_PASSWORD, ignore_wol_password ? NULL : wol_password, NM_SETTING_WIRED_AUTO_NEGOTIATE, autoneg, - NM_SETTING_WIRED_SPEED, autoneg ? 0 : speed, - NM_SETTING_WIRED_DUPLEX, autoneg ? NULL : duplex, + NM_SETTING_WIRED_SPEED, speed, + NM_SETTING_WIRED_DUPLEX, duplex, NULL); } diff --git a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 1656530911..fdb2e10a2e 100644 --- a/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -1135,6 +1135,9 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) /* Stuff ETHTOOL_OPT with required options */ str = NULL; auto_negotiate = nm_setting_wired_get_auto_negotiate (s_wired); + speed = nm_setting_wired_get_speed (s_wired); + duplex = nm_setting_wired_get_duplex (s_wired); + /* autoneg off + speed 0 + duplex NULL, means we want NM * to skip link configuration which is default. So write * down link config only if we have auto-negotiate true or @@ -1143,18 +1146,14 @@ write_wired_setting (NMConnection *connection, shvarFile *ifcfg, GError **error) if (auto_negotiate) { str = g_string_sized_new (64); g_string_printf (str, "autoneg on"); - } else { - speed = nm_setting_wired_get_speed (s_wired); - duplex = nm_setting_wired_get_duplex (s_wired); - if (speed || duplex) { - str = g_string_sized_new (64); - g_string_printf (str, "autoneg off"); - if (speed) - g_string_append_printf (str, " speed %u", speed); - if (duplex) - g_string_append_printf (str, " duplex %s", duplex); - } + } else if (speed || duplex) { + str = g_string_sized_new (64); + g_string_printf (str, "autoneg off"); } + if (speed) + g_string_append_printf (str, " speed %u", speed); + if (duplex) + g_string_append_printf (str, " duplex %s", duplex); wol = nm_setting_wired_get_wake_on_lan (s_wired); wol_password = nm_setting_wired_get_wake_on_lan_password (s_wired); |