From bd13f67442adc2a331f64aa1c25f27b038b64a8d Mon Sep 17 00:00:00 2001 From: Danilo Egea Gondolfo Date: Mon, 16 Dec 2024 15:33:35 +0000 Subject: [PATCH] parse: fix renderer validation for nm-devices When we process a nm-device we check to see if the renderer is NetworkManager. If it's not set to NetworkManager we log a warning message and change the backend. This verification can be only done after the netdef is processed. Move the verification so it happens after the call to process_mapping(). Fixes LP: #2091755 --- src/parse.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/parse.c b/src/parse.c index 6cc8c5701..db9c8d4fd 100644 --- a/src/parse.c +++ b/src/parse.c @@ -3376,11 +3376,6 @@ handle_network_type(NetplanParser* npp, yaml_node_t* node, const char* key_prefi case NETPLAN_DEF_TYPE_NM: g_debug("netplan: %s: handling NetworkManager passthrough device, settings are not fully supported.", npp->current.netdef->id); handlers = ethernet_def_handlers; - if (npp->current.netdef->backend != NETPLAN_BACKEND_NM) { - g_debug("nm-device: %s: the renderer for nm-devices must be NetworkManager, it will be used instead of the defined one.", - npp->current.netdef->id); - npp->current.netdef->backend = NETPLAN_BACKEND_NM; - } break; default: g_assert_not_reached(); // LCOV_EXCL_LINE } @@ -3409,6 +3404,12 @@ handle_network_type(NetplanParser* npp, yaml_node_t* node, const char* key_prefi } } + if (npp->current.netdef->type == NETPLAN_DEF_TYPE_NM && npp->current.netdef->backend != NETPLAN_BACKEND_NM) { + g_debug("nm-device: %s: the renderer for nm-devices must be NetworkManager, it will be used instead of the defined one.", + npp->current.netdef->id); + npp->current.netdef->backend = NETPLAN_BACKEND_NM; + } + /* Postprocessing */ /* Implicit VXLAN settings, which can be deduced from parsed data. */ if (npp->current.netdef->type == NETPLAN_DEF_TYPE_TUNNEL &&