summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2016-02-23 07:52:55 -0500
committerStephen Beaver <sbeaver@netgate.com>2016-02-23 07:52:55 -0500
commit3b8ca2c5df5a72c58122a54e93c18e0c81e0522d (patch)
tree1ceeb2700e5e94acf45c625d8453e9c10e215be0
parenta936104b3721ef60dd79b09ede67cea3d12d8093 (diff)
parentcf09c2f4d3cc885cd7ea5a84eeb1a4a342b8e34f (diff)
downloadpfsense-3b8ca2c5df5a72c58122a54e93c18e0c81e0522d.zip
pfsense-3b8ca2c5df5a72c58122a54e93c18e0c81e0522d.tar.gz
Merge pull request #2684 from NOYB/Firewall_/_Rules_-_Copy/Edit_-_Interface_Change_-_Separators_Update
-rw-r--r--src/usr/local/www/firewall_rules_edit.php33
1 files changed, 31 insertions, 2 deletions
diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php
index 9ad9efa..c7675ef 100644
--- a/src/usr/local/www/firewall_rules_edit.php
+++ b/src/usr/local/www/firewall_rules_edit.php
@@ -907,16 +907,45 @@ if ($_POST) {
pfSense_handle_custom_code("/usr/local/pkg/firewall_rules/pre_write_config");
if (isset($id) && $a_filter[$id]) {
- $a_filter[$id] = $filterent;
+ $tmpif = $filterent['interface'];
+ if (($tmpif == $if) || (isset($pconfig['floating']))) {
+ $a_filter[$id] = $filterent;
+ } else { // rule moved to different interface
+ // Update the separators of previous interface.
+ $a_separators = &$config['filter']['separator'][strtolower($if)];
+ $ridx = ifridx($if, $id); // get rule index within interface
+ $mvnrows = -1;
+ move_separators($a_separators, $ridx, $mvnrows);
+
+ $a_filter[$id] = $filterent; // save edited rule to new interface
+
+ // Update the separators of new interface.
+ $a_separators = &$config['filter']['separator'][strtolower($tmpif)];
+ $ridx = ifridx($tmpif, $id); // get rule index within interface
+ if ($ridx == 0) { // rule was placed at the top
+ $ridx = -1; // move all separators
+ }
+ $mvnrows = +1;
+ move_separators($a_separators, $ridx, $mvnrows);
+ }
+
} else {
$filterent['created'] = make_config_revision_entry();
if (is_numeric($after)) {
array_splice($a_filter, $after+1, 0, array($filterent));
- // For copy/dup the $if var is taken from the rule.
+ // For copy/dup the $if var is taken from the rule submission.
// In the case of floating rules that could be anything. But never "FloatingRules" that is needed.
if (isset($pconfig['floating'])) {
$tmpif = 'FloatingRules';
+ } else if (isset($filterent['interface'])) {
+ $tmpif = $filterent['interface'];
+ if ($tmpif != $if) { // rule copied to different interface
+ $ridx = ifridx($tmpif, $after+1); // get rule index within interface
+ if ($ridx == 0) { // rule was placed at the top
+ $after = -1; // move all separators
+ }
+ }
} else {
$tmpif = $if;
}
OpenPOWER on IntegriCloud