diff options
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-x | lib/Vyatta/Interface.pm | 43 |
1 files changed, 24 insertions, 19 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 150918c..3eb810b 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -76,7 +76,7 @@ my %net_prefix = ( '^peth[\d]+$' => { path => 'pseudo-ethernet', vif => 'vif', }, '^wlan[\d]+$' => { path => 'wireless', vif => 'vif' }, - '^in[\d]+$' => { path => 'incoming' }, + '^in[\d]+$' => { path => 'input' }, ); # get list of interface types (only used in usage function) @@ -107,19 +107,26 @@ sub _ppp_intf { } # Go path hunting to find ppp device -sub _ppp_path { - my ($intf, $type, $id) = @_; - my $config = new Vyatta::Config; +sub ppp_path { + my $self = shift; + + return unless ($self->{name} =~ /^(pppo[ae])(\d+)/); + my $type = $1; + my $id = $2; + my $intf = _ppp_intf($self->{name}); + return unless $intf; + + my $config = new Vyatta::Config; if ($type eq 'pppoe') { - my $path = "interfaces ethernet $intf pppoe $id"; - return $path if $config->exists($path); + my $path = "interfaces ethernet $intf pppoe $id"; + return $path if $config->exists($path); } my $adsl = "interfaces adsl $intf pvc"; foreach my $pvc ($config->listNodes($adsl)) { - my $path = "$adsl $pvc $type $id"; - return $path if $config->exists($path); + my $path = "$adsl $pvc $type $id"; + return $path if $config->exists($path); } return; @@ -138,18 +145,11 @@ sub new { # Special case for ppp devices if ($name =~ /^(pppo[ae])(\d+)/) { my $type = $1; - my $id = $2; - my $intf = _ppp_intf($name); - return unless $intf; - - my $path = _ppp_path($intf, $type, $id); - return unless $path; my $self = { - name => $name, - type => $type, - path => $path, - dev => $name, + name => $name, + type => $type, + dev => $name, }; bless $self, $class; return $self; @@ -200,7 +200,12 @@ sub name { sub path { my $self = shift; - return $self->{path}; + my $path = $self->{path}; + + return $path if defined($path); + + # Go path hunting to find ppp device + return ppp_path($self); } sub vif { |