aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/openbgpd/openbgpd.inc17
-rw-r--r--packages/openbgpd/openbgpd_groups.xml5
2 files changed, 22 insertions, 0 deletions
diff --git a/packages/openbgpd/openbgpd.inc b/packages/openbgpd/openbgpd.inc
index 3985a4aa..aff02c24 100644
--- a/packages/openbgpd/openbgpd.inc
+++ b/packages/openbgpd/openbgpd.inc
@@ -134,6 +134,23 @@ function deinstall_openbgpd() {
exec("killall bgpd");
}
+function check_group_usage($groupname) {
+ global $config, $g;
+ $openbgpd_conf = &$config['installedpackages']['openbgpd']['config'][0];
+ $openbgpd_rows = &$config['installedpackages']['openbgpd']['config'][0]['row'];
+ $openbgpd_groups = &$config['installedpackages']['openbgpdgroups']['config'];
+ $openbgpd_neighbors = &$config['installedpackages']['openbgpdneighbors']['config'];
+ if(is_array($openbgpd_groups)) {
+ foreach($openbgpd_groups as $group) {
+ foreach($openbgpd_neighbors as $neighbor) {
+ if($neighbor['groupname'] == $group['name'])
+ return true;
+ }
+ }
+ }
+ return false;
+}
+
function grey_out_value_boxes() {
echo <<<EOF
<script language="javascript">
diff --git a/packages/openbgpd/openbgpd_groups.xml b/packages/openbgpd/openbgpd_groups.xml
index 5521d208..6e80dbfe 100644
--- a/packages/openbgpd/openbgpd_groups.xml
+++ b/packages/openbgpd/openbgpd_groups.xml
@@ -106,4 +106,9 @@
<custom_php_resync_config_command>
openbgpd_install_conf();
</custom_php_resync_config_command>
+ <custom_php_validation_command>
+ $status = check_group_usage($_POST['groupname']);
+ if($status)
+ $input_errors[] = "Sorry this group is in use and cannot be deleted.";
+ </custom_php_validation_command>
</packagegui>