diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-12-01 13:13:30 -0800 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-12-01 16:51:00 -0800 |
commit | f27e23f90810bb0c23d0d4e0f7d093b110477a14 (patch) | |
tree | 24bb66d1531e3b4e7c1914fe6e690d47c603f15b | |
parent | c822ae10d02835479d31f3955b378816aa91bb0d (diff) | |
download | vyatta-cfg-quagga-f27e23f90810bb0c23d0d4e0f7d093b110477a14.tar.gz vyatta-cfg-quagga-f27e23f90810bb0c23d0d4e0f7d093b110477a14.zip |
Add handling for address ownership (priority 255) in RFC complient mode
-rwxr-xr-x | scripts/keepalived/vyatta-keepalived.pl | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/scripts/keepalived/vyatta-keepalived.pl b/scripts/keepalived/vyatta-keepalived.pl index f419ac41..f7b6bfe7 100755 --- a/scripts/keepalived/vyatta-keepalived.pl +++ b/scripts/keepalived/vyatta-keepalived.pl @@ -152,9 +152,23 @@ sub keepalived_get_values { my $priority = $config->returnValue("priority"); if ( !defined $priority ) { - $priority = 1; + $priority = 100; # Default backup priority is 100 from RFC. } + my $address_owner = 0; + $address_owner = 1 if ($priority == 255 && $use_vmac == 1); my $preempt = $config->returnValue("preempt"); + if (defined $preempt && $address_owner == 1){ + if ($preempt ne "true") { # the handling of default in configuration is odd so we need to allow it to be set to true... + $err = "cannot define preempt if this is the address owner"; + if ( defined $err ) { + next if $noerr; + @loc = split(/ /, "$path vrrp vrrp-group $group"); + Vyatta::Config::outputError(\@loc, $err); + push @errs, $err; + next; + } + } + } if ( !defined $preempt ) { $preempt = "true"; } @@ -171,7 +185,7 @@ sub keepalived_get_values { push @{ $HoA_sync_groups{$sync_group} }, $vrrp_instance; } my $hello_source_addr = $config->returnValue("hello-source-address"); - $err = validate_source_addr( $intf, $hello_source_addr ); + $err = validate_source_addr( $intf, $hello_source_addr ) if (!$address_owner == 1); if ( defined $err ) { next if $noerr; @loc = split(/ /, "$path vrrp vrrp-group $group"); @@ -179,6 +193,19 @@ sub keepalived_get_values { push @errs, $err; next; } + if (defined $hello_source_addr && $address_owner == 1){ + $err = "cannot define hello-source-address if this is the address owner"; + if ( defined $err ) { + next if $noerr; + @loc = split(/ /, "$path vrrp vrrp-group $group"); + Vyatta::Config::outputError(\@loc, $err); + push @errs, $err; + next; + } + } elsif ($address_owner == 1) { + $hello_source_addr = $vips[0]; + $hello_source_addr =~ s/(.*?)\/.*/$1/; + } $config->setLevel("$path vrrp vrrp-group $group"); my ($auth_type, $auth_pass) = (undef, undef); |