Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions src/opnsense/mvc/app/library/OPNsense/Firewall/SNatRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,12 +91,16 @@ private function parseNatRules()
$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) {
Expand Down
1 change: 1 addition & 0 deletions src/www/firewall_nat_out_edit.php
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down