From 3bad4baf6037975da01cd0f3abf846162567bf96 Mon Sep 17 00:00:00 2001 From: Alex Harpin Date: Mon, 6 Oct 2014 20:28:22 +0100 Subject: 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 --- lib/Vyatta/Interface.pm | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) (limited to 'lib') 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; -- cgit v1.2.3