Filter: associated nat rules miss state keyword and when they would, the tag wouldn't be processed properly ($rule['type'] --> pass)

The associated nat rules remain a terrible construct, ideally we would make sure the automated rule matches a regular one, but if they do, the firewall_rules_edit.php page has to handle all sorts of corner cases leading to other unexpected behaviour.

This fixes a bug, cleaning this up would either need proper validations in the filter page or no extra validations at all (create/update, only note the relation, but don't try to enforce anything when associated-rule-id is set.
This commit is contained in:
Ad Schellevis 2020-10-14 20:27:49 +02:00
parent 9ad7e5463f
commit 4235c72900
2 changed files with 2 additions and 1 deletions

View File

@ -205,7 +205,7 @@ class FilterRule extends Rule
}
}
// restructure state settings for easier output parsing
if (!empty($rule['statetype']) && $rule['type'] == 'pass') {
if (!empty($rule['statetype']) && ($rule['type'] == 'pass' || empty($rule['type']))) {
$rule['state'] = array('type' => 'keep', 'options' => array());
switch ($rule['statetype']) {
case 'none':

View File

@ -288,6 +288,7 @@ if ($_SERVER['REQUEST_METHOD'] === 'GET') {
// Update interface, protocol and destination
$filterent['interface'] = $natent['interface'];
$filterent['statetype'] = "keep state";
if (!empty($natent['protocol'])) {
$filterent['protocol'] = $natent['protocol'];
} elseif (isset($filterent['protocol'])) {