diff options
author | John Southworth <john.southworth@vyatta.com> | 2011-12-05 12:00:10 -0800 |
---|---|---|
committer | John Southworth <john.southworth@vyatta.com> | 2011-12-05 12:02:09 -0800 |
commit | 3a4ec8277bda4f6f9e82026a2d2c1cae0daf6f28 (patch) | |
tree | 4b462fa615e1cf08a5d8a5f6f063ab51bf7a94a3 /lib/Vyatta | |
parent | 90bfd66b803d9a70d0f2e17c91047707a6d00a4e (diff) | |
download | vyatta-cfg-3a4ec8277bda4f6f9e82026a2d2c1cae0daf6f28.tar.gz vyatta-cfg-3a4ec8277bda4f6f9e82026a2d2c1cae0daf6f28.zip |
Fix bug in vrrp interface handling
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-x | lib/Vyatta/Interface.pm | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 5e10819..cfc4a31 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -60,10 +60,13 @@ my %net_prefix = ( vif => 'vif', }, '^bond[\d]+$' => { path => 'bonding', vif => 'vif', }, + '^bond[\d]+v[\d]+$' => { path => 'vrrp' }, '^br[\d]+$' => { path => 'bridge', vif => 'vif' }, '^eth[\d]+$' => { path => 'ethernet', vif => 'vif', }, + '^eth[\d]+v[\d]+$' => { path => 'vrrp' }, + '^eth[\d]+.[\d]+v[\d]+$' => { path => 'vrrp' }, '^lo$' => { path => 'loopback' }, '^ml[\d]+$' => { path => 'multilink', vif => 'vif', }, @@ -264,14 +267,14 @@ sub new { return $self; } - # Strip off vif from name if ( $name =~ m/(\w+)\.(\d+)v(\d+)/ ){ $dev = $1; - $vif = $2; + $vif = $2; $vrid = $3; } elsif ( $name =~ m/(\w+)\v(\d+)/ ) { $dev = $1; $vrid = $2; + # Strip off vif from name } elsif ( $name =~ m/(\w+)\.(\d+)/ ) { $dev = $1; $vif = $2; @@ -285,7 +288,7 @@ sub new { my $vifpath = $net_prefix{$prefix}{vif}; # Interface name has vif, but this type doesn't support vif! - return if ( $vif && !$vifpath ); + return if ( $vif && !$vifpath && !$vrid); # Check path if given return if ( $#_ >= 0 && join( ' ', @_ ) ne $type ); @@ -293,6 +296,7 @@ sub new { my $path = "interfaces $type $dev"; $path .= " $vifpath $vif" if $vif; $path .= " vrrp vrrp-group $vrid interface" if $vrid; + $type = 'vrrp' if $vrid; my $self = { name => $name, @@ -300,6 +304,7 @@ sub new { path => $path, dev => $dev, vif => $vif, + vrid => $vrid }; bless $self, $class; @@ -330,6 +335,11 @@ sub vif { return $self->{vif}; } +sub vrid { + my $self = shift; + return $self->{vrid}; +} + sub physicalDevice { my $self = shift; return $self->{dev}; |