From 4ac24842a5d7244a12d7fd5dc456af2206696ed4 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Wed, 17 Oct 2007 03:46:07 +0000 Subject: Do not allow a group to be deleted when being referenced by a neighbor. --- packages/openbgpd/openbgpd.inc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) (limited to 'packages/openbgpd/openbgpd.inc') 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 << -- cgit v1.2.3