summaryrefslogtreecommitdiffstats
path: root/usr
diff options
context:
space:
mode:
authorErmal <eri@pfsense.org>2010-08-06 15:37:25 +0000
committerErmal <eri@pfsense.org>2010-08-06 15:37:25 +0000
commit62663b540871f35083e182fe77f85cd1bcedf9f8 (patch)
tree2c6cd24ebe4e4fd904c2164ce5b07c7c94f7e722 /usr
parent25cca20b4b4adbfedeb27a21b7b80f0f19ec89b3 (diff)
downloadpfsense-62663b540871f35083e182fe77f85cd1bcedf9f8.zip
pfsense-62663b540871f35083e182fe77f85cd1bcedf9f8.tar.gz
Ticket #792. Correctly unset the group name and update the new one if a interface group is renamed. For filter and nat rules too.
Diffstat (limited to 'usr')
-rwxr-xr-xusr/local/www/interfaces_groups_edit.php30
1 files changed, 26 insertions, 4 deletions
diff --git a/usr/local/www/interfaces_groups_edit.php b/usr/local/www/interfaces_groups_edit.php
index e1a9666..264cee3 100755
--- a/usr/local/www/interfaces_groups_edit.php
+++ b/usr/local/www/interfaces_groups_edit.php
@@ -78,8 +78,6 @@ if ($_POST) {
if ($gdescr == $_POST['ifname'] || $gif == $_POST['ifname'])
$input_errors[] = "The specified group name is already used by an interface. Please choose another name.";
}
- $ifgroupentry = array();
- $ifgroupentry['ifname'] = $_POST['ifname'];
$members = "";
$isfirst = 0;
/* item is a normal ifgroupentry type */
@@ -93,10 +91,31 @@ if ($_POST) {
}
if (!$input_errors) {
+ $ifgroupentry = array();
$ifgroupentry['members'] = $members;
$ifgroupentry['descr'] = mb_convert_encoding($_POST['descr'],"HTML-ENTITIES","auto");
- if (isset($id) && $a_ifgroups[$id]) {
+ if (isset($id) && $a_ifgroups[$id] && $_POST['ifname'] != $a_ifgroups[$id]['ifname']) {
+
+ foreach ($config['filter']['rule'] as $ridx => $rule) {
+ if ($rule['interface'] == $a_ifgroups[$id]['ifname'])
+ $config['filter']['rule'][$ridx]['interface'] = $_POST['ifname'];
+ }
+ foreach ($config['nat']['rule'] as $ridx => $rule) {
+ if ($rule['interface'] == $a_ifgroups[$id]['ifname'])
+ $config['nat']['rule'][$ridx]['interface'] = $_POST['ifname'];
+ }
+ $omembers = explode(" ", $a_ifgroups[$id]['members']);
+ if (count($omembers) > 0) {
+ foreach ($omembers as $ifs) {
+ $realif = get_real_interface($ifs);
+ if ($realif)
+ mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$id]['ifname']);
+ }
+ }
+ $ifgroupentry['ifname'] = $_POST['ifname'];
+ $a_ifgroups[$id] = $ifgroupentry;
+ } else if (isset($id) && $a_ifgroups[$id]) {
$omembers = explode(" ", $a_ifgroups[$id]['members']);
$nmembers = explode(" ", $members);
$delmembers = array_diff($omembers, $nmembers);
@@ -107,9 +126,12 @@ if ($_POST) {
mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$id]['ifname']);
}
}
+ $ifgroupentry['ifname'] = $_POST['ifname'];
$a_ifgroups[$id] = $ifgroupentry;
- } else
+ } else {
+ $ifgroupentry['ifname'] = $_POST['ifname'];
$a_ifgroups[] = $ifgroupentry;
+ }
write_config();
OpenPOWER on IntegriCloud