diff options
author | Ermal Luçi <eri@pfsense.org> | 2009-03-17 00:01:53 +0000 |
---|---|---|
committer | Ermal Luçi <eri@pfsense.org> | 2009-03-17 00:01:53 +0000 |
commit | 42753d259b3c7b51003cbd161e5ef15fa8a01d5c (patch) | |
tree | 73a9ff85299d7c1b8103ff3da6bc119a57d7f0ca /usr/local/www/interfaces_groups_edit.php | |
parent | 0ec2fdf0ad985ff390c6230f375e88cde5a4d61b (diff) | |
download | pfsense-42753d259b3c7b51003cbd161e5ef15fa8a01d5c.zip pfsense-42753d259b3c7b51003cbd161e5ef15fa8a01d5c.tar.gz |
Actually merge the part that does the real work with FreeBSD groups.
Diffstat (limited to 'usr/local/www/interfaces_groups_edit.php')
-rwxr-xr-x | usr/local/www/interfaces_groups_edit.php | 28 |
1 files changed, 23 insertions, 5 deletions
diff --git a/usr/local/www/interfaces_groups_edit.php b/usr/local/www/interfaces_groups_edit.php index 1044bed..6875885 100755 --- a/usr/local/www/interfaces_groups_edit.php +++ b/usr/local/www/interfaces_groups_edit.php @@ -59,9 +59,13 @@ if ($_POST) { unset($input_errors); $pconfig = $_POST; - foreach ($a_ifgroups as $groupentry) - if ($groupentry['ifname'] == $_POST['ifname']) - $input_errors[] = "Group name already exists!"; + if (empty($id)) { + foreach ($a_ifgroups as $groupentry) + if ($groupentry['ifname'] == $_POST['ifname']) + $input_errors[] = "Group name already exists!"; + } + if (preg_match("/([^a-zA-Z])+/", $_POST['ifname'], $match)) + $input_errors[] = "Only characters in a-z A-Z are allowed as interface name."; $ifgroupentry = array(); $ifgroupentry['ifname'] = $_POST['ifname']; @@ -81,13 +85,25 @@ if ($_POST) { $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]) { + $omembers = explode(" ", $a_ifgroups[$id]['members']); + $nmembers = explode(" ", $members); + $delmembers = array_diff($omembers, $nmembers); + if (count($delmembers) > 0) { + foreach ($delmembers as $ifs) { + $realif = get_real_interface($ifs); + if ($realif) + mwexec("/sbin/ifconfig {$realif} -group " . $a_ifgroups[$id]['ifname']); + } + } $a_ifgroups[$id] = $ifgroupentry; - else + } else $a_ifgroups[] = $ifgroupentry; write_config(); + interface_group_setup($ifgroupentry); + header("Location: interfaces_groups.php"); exit; } else { @@ -186,6 +202,8 @@ function removeRow(el) { <td valign="top" class="vncellreq">Interface</td> <td class="vtable"> <input class="formfld unknown" name="ifname" id="ifname" value="<?=$pconfig['ifname'];?>" /> + <br /> + No numbers or spaces are allowed. Only characters in a-zA-Z </td> </tr> <tr> |