From 82352ef62085b9e4bb98daf3c1e5a940148815f1 Mon Sep 17 00:00:00 2001 From: John Southworth Date: Fri, 2 Dec 2011 10:45:02 -0800 Subject: Add vrrp interface support to Interface library --- lib/Vyatta/Interface.pm | 39 ++++++++++++++++++++++++++++++++++++--- 1 file changed, 36 insertions(+), 3 deletions(-) diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index e22ae60..5e10819 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -138,7 +138,32 @@ sub get_all_cfg_interfaces { } } } - + # special case for vrrp + for my $eth ($cfg->$vfunc('interfaces ethernet')) { + for my $vrid ($cfg->$vfunc("interfaces ethernet $eth vrrp vrrp-group")) { + push @ret_ifs, { 'name' => $eth."v".$vrid, + 'path' => "interfaces ethernet $eth vrrp vrrp-group $vrid interface" }; + } + for my $vif ($cfg->$vfunc("interfaces ethernet $eth vif")) { + for my $vrid ($cfg->$vfunc("interfaces ethernet $eth vif $vif vrrp vrrp-group")) { + push @ret_ifs, { 'name' => $eth.".".$vif."v".$vrid, + 'path' => "interfaces ethernet $eth vif $vif vrrp vrrp-group $vrid interface" }; + } + } + } + for my $bond ($cfg->$vfunc('interfaces bonding')) { + for my $vrid ($cfg->$vfunc("interfaces bonding $bond vrrp vrrp-group")) { + push @ret_ifs, { 'name' => $bond."v".$vrid, + 'path' => "interfaces bonding $bond vrrp vrrp-group $vrid interface" }; + } + for my $vif ($cfg->$vfunc("interfaces bonding $bond vif")) { + for my $vrid ($cfg->$vfunc("interfaces bonding $bond vif $vif vrrp vrrp-group")) { + push @ret_ifs, { 'name' => $bond.".".$vif."v".$vrid, + 'path' => "interfaces bonding $bond vif $vif vrrp vrrp-group $vrid interface" }; + } + } + } + # now special cases for pppo*/adsl for my $eth ($cfg->$vfunc('interfaces ethernet')) { for my $ep ($cfg->$vfunc("interfaces ethernet $eth pppoe")) { @@ -221,7 +246,7 @@ sub new { my $that = shift; my $name = pop; my $class = ref($that) || $that; - my ($dev, $vif); + my ($dev, $vif, $vrid); # need argument to constructor return unless $name; @@ -240,7 +265,14 @@ sub new { } # Strip off vif from name - if ( $name =~ m/(\w+)\.(\d+)/ ) { + if ( $name =~ m/(\w+)\.(\d+)v(\d+)/ ){ + $dev = $1; + $vif = $2; + $vrid = $3; + } elsif ( $name =~ m/(\w+)\v(\d+)/ ) { + $dev = $1; + $vrid = $2; + } elsif ( $name =~ m/(\w+)\.(\d+)/ ) { $dev = $1; $vif = $2; } else { @@ -260,6 +292,7 @@ sub new { my $path = "interfaces $type $dev"; $path .= " $vifpath $vif" if $vif; + $path .= " vrrp vrrp-group $vrid interface" if $vrid; my $self = { name => $name, -- cgit v1.2.3 From 308a15edad480e8e58440f6b7b3e9ed17b6b901a Mon Sep 17 00:00:00 2001 From: John Southworth Date: Fri, 2 Dec 2011 11:21:29 -0800 Subject: 0.99.58 --- debian/changelog | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/debian/changelog b/debian/changelog index 86d655a..8b8ae5a 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +vyatta-cfg (0.99.58) unstable; urgency=low + + * Add vrrp interface support to Interface library + + -- John Southworth Fri, 02 Dec 2011 11:21:29 -0800 + vyatta-cfg (0.99.57) unstable; urgency=low * init: unload unneeded raid modules -- cgit v1.2.3