diff options
author | Alex Harpin <development@landsofshadow.co.uk> | 2014-10-06 20:28:22 +0100 |
---|---|---|
committer | Alex Harpin <development@landsofshadow.co.uk> | 2014-10-06 20:28:22 +0100 |
commit | 3bad4baf6037975da01cd0f3abf846162567bf96 (patch) | |
tree | 16abdb8cd509344bb4e9f71240073d934b10fc88 | |
parent | 98a62b65c4843afd17e6aabe24badeafa0cd8f3d (diff) | |
download | vyatta-cfg-3bad4baf6037975da01cd0f3abf846162567bf96.tar.gz vyatta-cfg-3bad4baf6037975da01cd0f3abf846162567bf96.zip |
vyatta-cfg: return correct path for pppoe or pppoa interfaces
Fix for the _ppp_int function so it returns the actual ethernet
interface associated with the ppp device rather than an empty string.
As a result the path function now returns the correct configuration
path for the interface.
Linked to Bug #321 http://bugzilla.vyos.net/show_bug.cgi?id=321
Bug #333 http://bugzilla.vyos.net/show_bug.cgi?id=333
-rwxr-xr-x | lib/Vyatta/Interface.pm | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/lib/Vyatta/Interface.pm b/lib/Vyatta/Interface.pm index 541c98c..8451d9e 100755 --- a/lib/Vyatta/Interface.pm +++ b/lib/Vyatta/Interface.pm @@ -208,7 +208,7 @@ sub physicalDevice { return $self->{dev}; } -# Read ppp config to fine associated interface for ppp device +# Read ppp config to find the associated interface for the ppp device sub _ppp_intf { my $dev = shift; my $intf; @@ -216,14 +216,13 @@ sub _ppp_intf { open(my $ppp, '<', "/etc/ppp/peers/$dev") or return; # no such device - while (<$ppp>) { - chomp; - - # looking for line like: - # pty "/usr/sbin/pppoe -m 1412 -I eth1" - next unless /^pty\s.*-I\s*(\w+)"/; - $intf = $1; - last; + while (my $line = <$ppp>) { + # looking for a line like: #pty "/usr/sbin/pppoe -m 1412 -I eth1" + # and stop after the first occurence of this line + if ($line =~ /^#pty\s.*-I\s*(\w+)"/) { + $intf = $1; + last; + } } close $ppp; |