summaryrefslogtreecommitdiff
path: root/lib/Vyatta
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-04-06 08:54:44 -0700
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-04-06 08:54:44 -0700
commitf98ce2d75cccca570f547c577f46c9f3870af93f (patch)
tree129e4137ce3d5a97fa0578f8f301bba1cddf551e /lib/Vyatta
parenta695e31f0f337de0521a62dbe52b462529f5bc78 (diff)
parent3d6755af79c4a694b43efdd3519b6ee10a4656a5 (diff)
downloadvyatta-cfg-f98ce2d75cccca570f547c577f46c9f3870af93f.tar.gz
vyatta-cfg-f98ce2d75cccca570f547c577f46c9f3870af93f.zip
Merge branch 'larkspur' of vm:git/vyatta-cfg into larkspur
Conflicts: lib/Vyatta/Interface.pm
Diffstat (limited to 'lib/Vyatta')
-rwxr-xr-xlib/Vyatta/Interface.pm43
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 {