summaryrefslogtreecommitdiff
path: root/scripts/keepalived/vyatta-show-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-show-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-show-vrrp.pl')
-rwxr-xr-xscripts/keepalived/vyatta-show-vrrp.pl24
1 files changed, 12 insertions, 12 deletions
diff --git a/scripts/keepalived/vyatta-show-vrrp.pl b/scripts/keepalived/vyatta-show-vrrp.pl
index 5ec2e8ad..521abc7f 100755
--- a/scripts/keepalived/vyatta-show-vrrp.pl
+++ b/scripts/keepalived/vyatta-show-vrrp.pl
@@ -24,6 +24,7 @@
#
use lib "/opt/vyatta/share/perl5/";
use Vyatta::Keepalived;
+use Vyatta::Interface;
use strict;
use warnings;
@@ -65,23 +66,22 @@ sub elapse_time {
}
sub get_state_link {
- my $intf = shift;
+ my $intf_name = shift;
- my $IFF_UP = 0x1;
+ my $intf = new Vyatta::Interface($intf_name);
+ die "Unknown interface [$intf_name]" unless $intf;
+
my ($state, $link);
- my $flags = `cat /sys/class/net/$intf/flags 2> /dev/null`;
- my $carrier = `cat /sys/class/net/$intf/carrier 2> /dev/null`;
- chomp $flags; chomp $carrier;
- my $hex_flags = hex($flags);
- if ($hex_flags & $IFF_UP) {
- $state = "up";
+ if ($intf->up()) {
+ $state = 'up';
} else {
- $state = "admin down";
+ $state = 'admin down';
}
- if ($carrier eq "1") {
- $link = "up";
+
+ if ($intf->carrier()) {
+ $link = 'up';
} else {
- $link = "down";
+ $link = 'down';
}
return ($state, $link);
}