From 4de9a6fa8e798446da96424d2db7530c863d2370 Mon Sep 17 00:00:00 2001 From: NOYB Date: Tue, 2 Aug 2016 22:17:14 -0700 Subject: [PATCH] Update firewall rules separators when NAT associated rule is deleted. Bug: https://redmine.pfsense.org/issues/6676 (cherry picked from commit 7475d7b337c0a08dc4d6636f33b0998067f26008) --- src/etc/inc/itemid.inc | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/etc/inc/itemid.inc b/src/etc/inc/itemid.inc index 2c16e8de822..2a3abe111c2 100644 --- a/src/etc/inc/itemid.inc +++ b/src/etc/inc/itemid.inc @@ -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; @@ -74,6 +76,7 @@ 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; } } @@ -81,6 +84,13 @@ function delete_id($id, &$array) { // 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;