diff --git a/include/types.h b/include/types.h index 6273c9b3f..df4ef1954 100644 --- a/include/types.h +++ b/include/types.h @@ -65,6 +65,7 @@ typedef enum { * requires links to another netdef (such as vlan_link) * but it's not strictly mandatory * It's intended to be used only when renderer is NetworkManager + * Keep the PLACEHOLDER_ and MAX_ elements at the end of the enum */ NETPLAN_DEF_TYPE_NM_PLACEHOLDER_, NETPLAN_DEF_TYPE_MAX_ diff --git a/src/parse-nm.c b/src/parse-nm.c index 215916fd1..0311cc80d 100644 --- a/src/parse-nm.c +++ b/src/parse-nm.c @@ -668,7 +668,9 @@ netplan_parser_load_keyfile(NetplanParser* npp, const char* filename, GError** e nd_id = g_strdup(netdef_id); if (g_strcmp0(netdef_id, tmp_str) == 0) _kf_clear_key(kf, "connection", "interface-name"); - } else if (tmp_str && nd_type >= NETPLAN_DEF_TYPE_VIRTUAL && nd_type < NETPLAN_DEF_TYPE_NM) { + } else if (tmp_str && nd_type != NETPLAN_DEF_TYPE_NM + && nd_type >= NETPLAN_DEF_TYPE_VIRTUAL + && nd_type < NETPLAN_DEF_TYPE_NM_PLACEHOLDER_) { /* netdef ID equals "interface-name" for virtual devices (bridge/bond/...) */ nd_id = g_strdup(tmp_str); _kf_clear_key(kf, "connection", "interface-name");