mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-06-14 07:38:26 +02:00
ifcfg-rh: fix persisting all-default NMSettingEthtool settings
We somehow need to encode an NMSettingEthtool instance that has all options unset. Previously, that would result in no "$ETHTOOL_OPTS" variable and thus the reader would loose a previously existing setting. Hack it by writing a bogus ETHTOOL_OPTS="-A $IFACE" line.
This commit is contained in:
parent
ef0f9b871b
commit
26ed9e6714
3 changed files with 10 additions and 1 deletions
|
|
@ -1376,6 +1376,13 @@ write_ethtool_setting(NMConnection *connection, shvarFile *ifcfg, GError **error
|
||||||
g_string_append(str, nms_ifcfg_rh_utils_get_ethtool_name(ethtool_id));
|
g_string_append(str, nms_ifcfg_rh_utils_get_ethtool_name(ethtool_id));
|
||||||
g_string_append(str, b ? " on" : " off");
|
g_string_append(str, b ? " on" : " off");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!str) {
|
||||||
|
/* Write an empty dummy "-A" option without arguments. This is to
|
||||||
|
* ensure that the reader will create an (all default) NMSettingEthtool.
|
||||||
|
* Also, it seems that `ethtool -A "$IFACE"` is silently accepted. */
|
||||||
|
_ethtool_gstring_prepare(&str, &is_first, 'A', iface);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (str) {
|
if (str) {
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
TYPE=Ethernet
|
TYPE=Ethernet
|
||||||
PROXY_METHOD=none
|
PROXY_METHOD=none
|
||||||
BROWSER_ONLY=no
|
BROWSER_ONLY=no
|
||||||
|
ETHTOOL_OPTS="-A net0"
|
||||||
BOOTPROTO=dhcp
|
BOOTPROTO=dhcp
|
||||||
DEFROUTE=yes
|
DEFROUTE=yes
|
||||||
IPV4_FAILURE_FATAL=no
|
IPV4_FAILURE_FATAL=no
|
||||||
|
|
|
||||||
|
|
@ -3969,7 +3969,8 @@ test_roundtrip_ethtool(void)
|
||||||
NULL,
|
NULL,
|
||||||
NM_SETTING_WIRED_SETTING_NAME,
|
NM_SETTING_WIRED_SETTING_NAME,
|
||||||
NULL);
|
NULL);
|
||||||
/* TODO: add empty NMSettingEthtool, which currently would break the test. */
|
s_ethtool = nm_setting_ethtool_new();
|
||||||
|
nm_connection_add_setting(connection, s_ethtool);
|
||||||
_writer_new_connec_exp(connection,
|
_writer_new_connec_exp(connection,
|
||||||
TEST_SCRATCH_DIR,
|
TEST_SCRATCH_DIR,
|
||||||
TEST_IFCFG_DIR "/ifcfg-test_roundtrip_ethtool-2.cexpected",
|
TEST_IFCFG_DIR "/ifcfg-test_roundtrip_ethtool-2.cexpected",
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue