From 6984aefe437bb0b9d503a403eda488f59c888809 Mon Sep 17 00:00:00 2001 From: Franco Fichtner Date: Thu, 22 Feb 2024 12:44:59 +0100 Subject: [PATCH] system: ignore legacy invalid gateway structure Adds a spurious gateway due to presence of but it it also begs the question why we go into legacy mode when we only have automatic gateways so none are stored in the MVC model, which is kind of a standard case. --- src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php b/src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php index 7d60bdf91..2c4eaddb4 100644 --- a/src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php +++ b/src/opnsense/mvc/app/models/OPNsense/Routing/Gateways.php @@ -184,7 +184,7 @@ class Gateways extends BaseModel $config = Config::getInstance()->object(); if (!empty($config->gateways) && count($config->gateways->children()) > 0) { foreach ($config->gateways->children() as $tag => $gateway) { - if ($tag == 'gateway_item') { + if ($tag == 'gateway_item' && count(gateways->children()) > 0) { $record = []; // iterate over the individual nodes since empty nodes still return a // SimpleXMLObject when the container is converted to an array