summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorStig Thormodsrud <stig@io.vyatta.com>2009-02-28 13:36:44 -0800
committerStig Thormodsrud <stig@io.vyatta.com>2009-02-28 13:36:44 -0800
commit0294f753e1b788b115ec75e660ef10212a0128b2 (patch)
tree4d7a2e6ba9be9040caad63c1c2e4c29f55b7a17c /scripts
parent7775cbb1736fe6134be36674d49d2f3e6626e352 (diff)
downloadvyatta-cfg-quagga-0294f753e1b788b115ec75e660ef10212a0128b2.tar.gz
vyatta-cfg-quagga-0294f753e1b788b115ec75e660ef10212a0128b2.zip
Fix 3778: vrrp should allow prefix to be included with the virtual-address
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/keepalived/vyatta-keepalived.pl21
1 files changed, 19 insertions, 2 deletions
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl
index b2f0ba3b..a553a1ce 100755
--- a/scripts/keepalived/vyatta-keepalived.pl
+++ b/scripts/keepalived/vyatta-keepalived.pl
@@ -26,6 +26,7 @@
use lib "/opt/vyatta/share/perl5/";
use Vyatta::Config;
use Vyatta::Keepalived;
+use Vyatta::TypeChecker;
use Getopt::Long;
use strict;
@@ -351,11 +352,12 @@ sub keepalived_write_file {
#
# main
#
-my ($action, $vrrp_intf, $vrrp_group);
+my ($action, $vrrp_intf, $vrrp_group, $vrrp_vip);
GetOptions("vrrp-action=s" => \$action,
"intf=s" => \$vrrp_intf,
- "group=s" => \$vrrp_group);
+ "group=s" => \$vrrp_group,
+ "vip=s" => \$vrrp_vip);
if (! defined $action) {
print "no action\n";
@@ -396,6 +398,21 @@ if ($action eq "delete") {
exit 0;
}
+if ($action eq "check-vip") {
+ if (! defined $vrrp_vip) {
+ print "must include the virtual-address to check";
+ exit 1;
+ }
+ my $rc = 1;
+ if ($vrrp_vip =~ /\//) {
+ $rc = Vyatta::TypeChecker::validateType('ipv4net', $vrrp_vip, 1);
+ } else {
+ $rc = Vyatta::TypeChecker::validateType('ipv4', $vrrp_vip, 1);
+ }
+ exit 1 if ! $rc;
+ exit 0;
+}
+
exit 0;
# end of file