summaryrefslogtreecommitdiff
path: root/lib/Vyatta/Misc.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Vyatta/Misc.pm')
-rwxr-xr-xlib/Vyatta/Misc.pm19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/Vyatta/Misc.pm b/lib/Vyatta/Misc.pm
index 6b90a9c..2a5c880 100755
--- a/lib/Vyatta/Misc.pm
+++ b/lib/Vyatta/Misc.pm
@@ -519,7 +519,24 @@ sub interface_description {
my $description = <$ifalias>;
close $ifalias;
- chomp $description if $description;
+
+ # If the interface has a description set then just use that, if not then check
+ # the active config to see if one is configured there. Used for interfaces
+ # that can be destroyed and recreated during opertion, but then don't have
+ # their description reset.
+
+ if ($description){
+ chomp $description;
+ } else {
+ my $intf = new Vyatta::Interface($name);
+ my $config = new Vyatta::Config;
+
+ $config->setLevel( $intf->path() );
+
+ if ($config->existsOrig('description')) {
+ $description = $config->returnOrigValue('description');
+ }
+ }
return $description;
}