diff options
author | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-02-10 16:38:33 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen.hemminger@vyatta.com> | 2010-02-10 16:38:33 -0800 |
commit | fe9b6c23d75809ab40a100c20ea044978d0c2999 (patch) | |
tree | 8ed76679633e76a527515131e1b0cda772b4528f /lib | |
parent | d761bf023bdcd31bdc5f518775fa9caad18bcbf4 (diff) | |
download | vyatta-cfg-fe9b6c23d75809ab40a100c20ea044978d0c2999.tar.gz vyatta-cfg-fe9b6c23d75809ab40a100c20ea044978d0c2999.zip |
Fix handling of pppoe devices
PPPoE devices don't have VIF's and are named 'pppoeN' not 'pppN'.
Diffstat (limited to 'lib')
-rwxr-xr-x | lib/Vyatta/Interface.pm | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 200cad8..a11b7c2 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -78,7 +78,7 @@ my %net_prefix = ( '^wlan[\d]+$' => { path => 'wireless', vif => 'vif' }, ); -# get list of interface types (missing PPP) +# get list of interface types (only used in usage function) sub interface_types { my @types = map { $net_prefix{$_}{path} } keys %net_prefix; return @types; @@ -86,10 +86,10 @@ sub interface_types { # Read pppoe config to fine associated ethernet for ppp device sub find_pppoe { - my $n = shift; + my $dev = shift; my $eth; - open (my $pppoe, '<', "/etc/ppp/peers/pppoe$n") + open (my $pppoe, '<', "/etc/ppp/peers/$dev") or return; # no such device while (<$pppoe>) { @@ -115,6 +115,23 @@ sub new { # need argument to constructor return unless $name; + # Special case for pppoe devices + if ($name =~ /^pppoe(\d+)/) { + my $n = $1; + my $eth = find_pppoe($name); + + return unless $eth; + + my $self = { + name => $name, + type => 'pppoe', + path => "interfaces ethernet $eth pppoe $n", + dev => $name, + }; + bless $self, $class; + return $self; + } + # Strip off vif from name if ( $name =~ m/(\w+)\.(\d+)/ ) { $dev = $1; @@ -149,24 +166,6 @@ sub new { return $self; } - # Special case for pppoe - if ($dev =~ /^ppp(\d+)/) { - my $n = $1; - my $eth = find_pppoe($n); - - if ($eth) { - my $self = { - name => $name, - type => 'pppoe', - path => "interfaces ethernet $eth pppoe $n", - dev => $dev, - vif => $vif, - }; - bless $self, $class; - return $self; - } - } - return; # nothing } |