Page MenuHomePhabricator

[DONT FIX] most functions in Interface.pm are broken
Open, Requires assessmentPublicBUG

Description

All functions that rely in interface path such as mtu(), disabled() etc. are broken.

Do this:

set interfaces dummy dum0 disable

Run this script:

use lib "/opt/vyatta/share/perl5/";
use Vyatta::Config;
use Vyatta::Interface;

$intf = new Vyatta::Interface("dum1");

if ($intf->disabled()) {
  print "disabled\n";
}

It produces no output. That's because they try to use $self->{path}, while path is a method and not a field. Perl just passes it silently and returns undef, despite strict and warnings.
They have been broken from their inception in 2009.

The worst part is that there's code using those functions, which means it only works despite wrong resulsts, or worse, because of wrong results. Just fixing Interface.pm without also reviewing and fixing that code may have disastrous results.

Details

Difficulty level
Hard (possibly days)
Version
1.2.0
Why the issue appeared?
Will be filled on close

Event Timeline

runar added a subscriber: runar.Jun 11 2019, 4:29 AM
pasik added a subscriber: pasik.Jun 11 2019, 9:33 PM
dmbaturin removed a project: VyOS 1.2 Crux.