ifcfg-rh: write all [ethernet] settings for write_wired_for_virtual()

It's not the task of the writer to mangle/normalize profiles. If a profile
for a virtual device can have an [ethernet] setting, then unsuitable values
like s390 options must be either rejected by nm_connection_verify() or normalized
by nm_connection_normalize(). In no way it's right that the writer simple
pretends they are not set.
This commit is contained in:
Thomas Haller
2021-05-10 22:48:15 +02:00
parent 166c458411
commit 6f3f25cead

View File

@@ -1096,7 +1096,6 @@ write_wired_setting_impl(NMSettingWired *s_wired, shvarFile *ifcfg, gboolean is_
"GENERATE_MAC_ADDRESS_MASK",
nm_setting_wired_get_generate_mac_address_mask(s_wired));
if (!is_virtual) {
macaddr_blacklist = nm_setting_wired_get_mac_address_blacklist(s_wired);
if (macaddr_blacklist[0]) {
gs_free char *blacklist_str = NULL;
@@ -1104,12 +1103,10 @@ write_wired_setting_impl(NMSettingWired *s_wired, shvarFile *ifcfg, gboolean is_
blacklist_str = g_strjoinv(" ", (char **) macaddr_blacklist);
svSetValueStr(ifcfg, "HWADDR_BLACKLIST", blacklist_str);
}
}
mtu = nm_setting_wired_get_mtu(s_wired);
svSetValueInt64_cond(ifcfg, "MTU", mtu != 0, mtu);
if (!is_virtual) {
s390_subchannels = nm_setting_wired_get_s390_subchannels(s_wired);
{
@@ -1130,13 +1127,9 @@ write_wired_setting_impl(NMSettingWired *s_wired, shvarFile *ifcfg, gboolean is_
svSetValueStr(ifcfg, "NETTYPE", nm_setting_wired_get_s390_nettype(s_wired));
svSetValueStr(ifcfg,
"PORTNAME",
nm_setting_wired_get_s390_option_by_key(s_wired, "portname"));
svSetValueStr(ifcfg, "PORTNAME", nm_setting_wired_get_s390_option_by_key(s_wired, "portname"));
svSetValueStr(ifcfg,
"CTCPROT",
nm_setting_wired_get_s390_option_by_key(s_wired, "ctcprot"));
svSetValueStr(ifcfg, "CTCPROT", nm_setting_wired_get_s390_option_by_key(s_wired, "ctcprot"));
num_opts = nm_setting_wired_get_num_s390_options(s_wired);
if (s390_subchannels && num_opts) {
@@ -1168,7 +1161,6 @@ write_wired_setting_impl(NMSettingWired *s_wired, shvarFile *ifcfg, gboolean is_
if (tmp)
svSetValueStr(ifcfg, "OPTIONS", tmp->str);
}
}
if (!is_virtual)
svSetValueStr(ifcfg, "TYPE", TYPE_ETHERNET);