diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index 82516a6692..1c5bbbb43c 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -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, 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) { diff --git a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-2.cexpected b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-2.cexpected index 5186f90c5e..5632ebec8e 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-2.cexpected +++ b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test_roundtrip_ethtool-2.cexpected @@ -1,6 +1,7 @@ TYPE=Ethernet PROXY_METHOD=none BROWSER_ONLY=no +ETHTOOL_OPTS="-A net0" BOOTPROTO=dhcp DEFROUTE=yes IPV4_FAILURE_FATAL=no diff --git a/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 6cd2f38973..6193b952b9 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -3969,7 +3969,8 @@ test_roundtrip_ethtool(void) NULL, NM_SETTING_WIRED_SETTING_NAME, 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, TEST_SCRATCH_DIR, TEST_IFCFG_DIR "/ifcfg-test_roundtrip_ethtool-2.cexpected",