fix php warning: Undefined array key "XXX" in /usr/local/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php on line 95

This commit is contained in:
Ad Schellevis 2024-12-11 20:55:14 +01:00
parent 002b450c40
commit 5b8f903e53

View File

@ -92,10 +92,11 @@ class SNatRule extends Rule
$rule['disabled'] = true;
}
} elseif (preg_match("/^(wan|lan|opt[0-9]+)ip$/", $rule['target'], $matches)) {
$rule['target'] = "({$this->interfaceMapping["{$matches[1]}"]['if']}:0)";
if (empty($this->interfaceMapping["{$matches[1]}"])) {
$this->log("SNAT / target missing");
$rule['disabled'] = true;
} else {
$rule['target'] = "({$this->interfaceMapping["{$matches[1]}"]['if']}:0)";
}
}
foreach (array("sourceport", "dstport", "natport") as $fieldname) {