summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/diag_backup.php18
-rwxr-xr-xusr/local/www/firewall_aliases_edit.php31
2 files changed, 18 insertions, 31 deletions
diff --git a/usr/local/www/diag_backup.php b/usr/local/www/diag_backup.php
index c66af08..bb8a533 100755
--- a/usr/local/www/diag_backup.php
+++ b/usr/local/www/diag_backup.php
@@ -318,6 +318,24 @@ if ($_POST) {
if(is_array($ifdescrs))
foreach($ifdescrs as $iface)
$config['interfaces'][$iface]['descr'] = remove_bad_chars($config['interfaces'][$iface]['descr']);
+ /* check for interface names with an alias */
+ if(is_array($ifdescrs)) {
+ foreach($ifdescrs as $iface) {
+ if(is_alias($config['interfaces'][$iface]['descr'])) {
+ // Firewall rules
+ $origname = $config['interfaces'][$iface]['descr'];
+ $newname = $config['interfaces'][$iface]['descr'] . "Alias";
+ update_alias_names_upon_change('filter', 'rule', 'source', 'address', $newname);
+ update_alias_names_upon_change('filter', 'rule', 'destination', 'address', $newname);
+ // NAT Rules
+ update_alias_names_upon_change('nat', 'rule', 'target', '', $newname);
+ update_alias_names_upon_change('nat', 'rule', 'external-port', '', $newname);
+ update_alias_names_upon_change('nat', 'rule', 'local-port', '', $newname);
+ // Alias in an alias
+ update_alias_names_upon_change('aliases', 'alias', 'address', '', $newname);
+ }
+ }
+ }
unlink_if_exists("{$g['tmp_path']}/config.cache");
// Reset configuration version to something low
// in order to force the config upgrade code to
diff --git a/usr/local/www/firewall_aliases_edit.php b/usr/local/www/firewall_aliases_edit.php
index 487aea5..ee0f71b 100755
--- a/usr/local/www/firewall_aliases_edit.php
+++ b/usr/local/www/firewall_aliases_edit.php
@@ -60,37 +60,6 @@ if($_POST)
if($debug)
exec("rm -f {$g['tmp_path']}/alias_rename_log.txt");
-function update_alias_names_upon_change($section, $subsection, $fielda, $fieldb, $new_alias_name) {
- global $g, $config, $pconfig, $origname, $debug;
- if(!$origname)
- return;
-
- if($debug) $fd = fopen("{$g['tmp_path']}/print_r", "a");
- if($debug) fwrite($fd, print_r($pconfig, true));
-
- if($fieldb) {
- if($debug) fwrite($fd, "fieldb exists\n");
- for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) {
- if($debug) fwrite($fd, "$i\n");
- if($config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] == $origname) {
- if($debug) fwrite($fd, "Setting old alias value $origname to $new_alias_name\n");
- $config["$section"]["$subsection"][$i]["$fielda"]["$fieldb"] = $new_alias_name;
- }
- }
- } else {
- if($debug) fwrite($fd, "fieldb does not exist\n");
- for ($i = 0; isset($config["$section"]["$subsection"][$i]["$fielda"]); $i++) {
- if($config["$section"]["$subsection"][$i]["$fielda"] == $origname) {
- $config["$section"]["$subsection"][$i]["$fielda"] = $new_alias_name;
- if($debug) fwrite($fd, "Setting old alias value $origname to $new_alias_name\n");
- }
- }
- }
-
- if($debug) fclose($fd);
-
-}
-
function alias_same_type($name, $type) {
global $config;
OpenPOWER on IntegriCloud