ifcfg: always write ethernet.s390-options even without subchannels

For the umpteenth time: it is not ifcfg-rh writers decision to decide
what are valid configurations and only persist settings based on
some other settings.

If s390-options would only be allowed together with subchannels, then
this is alone nm_connection_verify()'s task to ensure.

Reproduce with

  $ nmcli connection add type ethernet autoconnect no con-name zz ethernet.s390-options bridge_role=primary

Related: https://bugzilla.redhat.com/show_bug.cgi?id=1935842

Fixes: 16bccfd672 ('core: handle s390 options more cleanly')
(cherry picked from commit d391f20730)
(cherry picked from commit b425793d90)
This commit is contained in:
Thomas Haller 2021-06-25 10:50:39 +02:00 committed by Beniamino Galvani
parent d7c6fea149
commit cfd37f2758

View file

@ -1137,7 +1137,7 @@ write_wired_setting(NMConnection *connection, shvarFile *ifcfg, GError **error)
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) {
if (num_opts > 0) {
nm_auto_free_gstring GString *tmp = NULL;
for (i = 0; i < num_opts; i++) {