Skip to content

Commit

Permalink
Update firewall rules separators when NAT associated rule is deleted.
Browse files Browse the repository at this point in the history
Bug: https://redmine.pfsense.org/issues/6676
(cherry picked from commit 7475d7b)
  • Loading branch information
NOYB authored and sbeaver-netgate committed Aug 3, 2016
1 parent be59d66 commit 4de9a6f
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/etc/inc/itemid.inc
Expand Up @@ -62,6 +62,8 @@
* boolean - true if item was found and deleted
******/
function delete_id($id, &$array) {
global $config;

// Index to delete
$delete_index = NULL;

Expand All @@ -74,13 +76,21 @@ function delete_id($id, &$array) {
// If this item is the one we want to delete
if (isset($item['associated-rule-id']) && $item['associated-rule-id'] == $id) {
$delete_index = $key;
$if = $item['interface'];
break;
}
}

// If we found the item, unset it
if ($delete_index !== NULL) {
unset($array[$delete_index]);

// Update the separators
$a_separators = &$config['filter']['separator'][strtolower($if)];
$ridx = ifridx($if, $delete_index); // get rule index within interface
$mvnrows = -1;
move_separators($a_separators, $ridx, $mvnrows);

return true;
} else {
return false;
Expand Down

0 comments on commit 4de9a6f

Please sign in to comment.