This commit is contained in:
Steve Kerrison 2026-02-01 20:53:22 +01:00 committed by GitHub
commit cc452a494d
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 7 additions and 2 deletions

View file

@ -91,12 +91,16 @@ class SNatRule extends Rule
$this->log('SNAT / pool type not round-robin');
$rule['disabled'] = true;
}
} elseif (preg_match("/^(wan|lan|opt[0-9]+)ip$/", $rule['target'], $matches)) {
} elseif (preg_match("/^(wan|lan|opt[0-9]+)(ip)?$/", $rule['target'], $matches)) {
if (empty($this->interfaceMapping["{$matches[1]}"])) {
$this->log("SNAT / target missing");
$rule['disabled'] = true;
} else {
} elseif (count($matches) == 3) {
// interface was suffixed by "ip", use its primary address
$rule['target'] = "({$this->interfaceMapping["{$matches[1]}"]['if']}:0)";
} else {
// network is possible here also, but only without aliases
$rule['target'] = "({$this->interfaceMapping["{$matches[1]}"]['if']}:network:0)";
}
}
foreach (array("sourceport", "dstport", "natport") as $fieldname) {

View file

@ -40,6 +40,7 @@ function formTranslateAddresses() {
// add this hosts ips
foreach (legacy_config_get_interfaces(array('virtual' => false, "enable" => true)) as $intf => $intfdata) {
$retval[$intf] = (!empty($intfdata['descr']) ? $intfdata['descr'] : $intf ) . " " . gettext("net");
$retval[$intf."ip"] = (!empty($intfdata['descr']) ? $intfdata['descr'] : $intf ) . " " . gettext("address");
}