summaryrefslogtreecommitdiff
path: root/scripts/keepalived/vyatta-clear-vrrp.pl
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@vyatta.com>2009-11-01 10:02:49 -0800
committerStig Thormodsrud <stig@vyatta.com>2009-11-01 10:02:49 -0800
commitf197d4eebd25f3bcbd0f6b5589ce9370a2f501da (patch)
tree6fd6fe628f95d4b9f67f54f6b0ac91a7be339e28 /scripts/keepalived/vyatta-clear-vrrp.pl
parent37dbea348afb8d0770767441c30e5ab1e2cea874 (diff)
downloadvyatta-cfg-quagga-f197d4eebd25f3bcbd0f6b5589ce9370a2f501da.tar.gz
vyatta-cfg-quagga-f197d4eebd25f3bcbd0f6b5589ce9370a2f501da.zip
Convert keepalived to use Interface infrastructure.
Diffstat (limited to 'scripts/keepalived/vyatta-clear-vrrp.pl')
-rw-r--r--scripts/keepalived/vyatta-clear-vrrp.pl65
1 files changed, 20 insertions, 45 deletions
diff --git a/scripts/keepalived/vyatta-clear-vrrp.pl b/scripts/keepalived/vyatta-clear-vrrp.pl
index ba5d569b..3a9733ed 100644
--- a/scripts/keepalived/vyatta-clear-vrrp.pl
+++ b/scripts/keepalived/vyatta-clear-vrrp.pl
@@ -25,6 +25,9 @@
use lib '/opt/vyatta/share/perl5/';
use Vyatta::Keepalived;
+use Vyatta::Interface;
+use Vyatta::Misc;
+
use Getopt::Long;
use Sys::Syslog qw(:standard :macros);
@@ -108,51 +111,23 @@ sub get_vrrp_intf_group {
#
# return an array of hashes that contains all the intf/group pairs
#
-
- foreach my $type (("ethernet", "bonding")) {
-
- my $config = new Vyatta::Config;
- $config->setLevel("interfaces $type");
- my @eths = $config->listOrigNodes();
- foreach my $eth (@eths) {
- my $path = "interfaces $type $eth";
- $config->setLevel($path);
- if ($config->existsOrig("vrrp")) {
- $path = "$path vrrp vrrp-group";
- $config->setLevel($path);
- my @groups = $config->listOrigNodes();
- foreach my $group (@groups) {
- my %hash;
- $hash{'intf'} = $eth;
- $hash{'group'} = $group;
- $hash{'path'} = "$path $group";
- push @array, {%hash};
- }
- }
-
- $path = "interfaces $type $eth";
+ my $config = new Vyatta::Config;
+
+ foreach my $name ( getInterfaces() ) {
+ my $intf = new Vyatta::Interface($name);
+ next unless $intf;
+ my $path = $intf->path();
+ $config->setLevel($path);
+ if ($config->existsOrig('vrrp')) {
+ $path = "$path vrrp vrrp-group";
$config->setLevel($path);
- if ($config->existsOrig('vif')) {
- my $path = "$path vif";
- $config->setLevel($path);
- my @vifs = $config->listOrigNodes();
- foreach my $vif (@vifs) {
- my $vif_intf = $eth . '.' . $vif;
- my $vif_path = "$path $vif";
- $config->setLevel($vif_path);
- if ($config->existsOrig('vrrp')) {
- $vif_path = "$vif_path vrrp vrrp-group";
- $config->setLevel($vif_path);
- my @groups = $config->listOrigNodes();
- foreach my $group (@groups) {
- my %hash;
- $hash{'intf'} = $vif_intf;
- $hash{'group'} = $group;
- $hash{'path'} = "$path $group";
- push @array, {%hash};
- }
- }
- }
+ my @groups = $config->listOrigNodes();
+ foreach my $group (@groups) {
+ my %hash;
+ $hash{'intf'} = $name;
+ $hash{'group'} = $group;
+ $hash{'path'} = "$path $group";
+ push @array, {%hash};
}
}
}
@@ -207,7 +182,7 @@ my $login = getlogin();
#
# clear_process
#
-if ($action eq "clear_process") {
+if ($action eq 'clear_process') {
syslog('warning', "clear vrrp process requested by $login");
if (Vyatta::Keepalived::is_running()) {
print "Restarting VRRP...\n";