Firewall/rule parsing, ok, someone thought it was a good idea to use the "network" field in outbound rules as the "address" field in all the other rule types.... not a big fan of duplicating code, but for now it's bett

er to keep the address conversion in one spot (which some duplicate code).

All still for https://github.com/opnsense/core/issues/1326
This commit is contained in:
Ad Schellevis 2017-12-26 18:45:24 +01:00
parent 50a0b8c39f
commit 8a0ac7ca25

View File

@ -227,10 +227,14 @@ abstract class Rule
if (!empty($interfaces[$matches[1]]['if'])) {
$rule[$target] = "({$interfaces["{$matches[1]}"]['if']})";
}
} else {
if (!empty($interfaces[$network_name]['if'])) {
$rule[$target] = "({$interfaces[$network_name]['if']}:network)";
}
} elseif (!empty($interfaces[$network_name]['if'])) {
$rule[$target] = "({$interfaces[$network_name]['if']}:network)";
} elseif (Util::isIpAddress($rule[$tag]['network']) || Util::isSubnet($rule[$tag]['network'])) {
$rule[$target] = $rule[$tag]['network'];
} elseif (Util::isAlias($rule[$tag]['network'])) {
$rule[$target] = '$'.$rule[$tag]['network'];
} elseif ($rule[$tag]['network'] == 'any') {
$rule[$target] = $rule[$tag]['network'];
}
} elseif (!empty($rule[$tag]['address'])) {
if (Util::isIpAddress($rule[$tag]['address']) || Util::isSubnet($rule[$tag]['address']) ||