summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Harpin <development@landsofshadow.co.uk>2014-09-14 22:04:57 +0100
committerAlex Harpin <development@landsofshadow.co.uk>2014-09-14 22:04:57 +0100
commit911e749ddf4125c44c776124c8b4c214b8adddf8 (patch)
tree69a8ca206d4856b62e462001ac80e7067beba054
parentf432c1da6a1218a8fe9901f15745e05d0a9e68f5 (diff)
downloadvyatta-cfg-911e749ddf4125c44c776124c8b4c214b8adddf8.tar.gz
vyatta-cfg-911e749ddf4125c44c776124c8b4c214b8adddf8.zip
vyatta-cfg: display openvpn interface descriptions after they reset
When OpenVPN tunnels are taken down and recreated by the OpenVPN process, any previously set descriptions on the interfaces are missing. This is caused by the fact that the ifalias for that interface isn't readded when the interface is recreated. This patch updates the interface_description function so that it either returns the current value of ifalias if it's set on the interface, or uses the value set in the active config if it's present. Bug #7 http://bugzilla.vyos.net/show_bug.cgi?id=7 Bug #313 http://bugzilla.vyos.net/show_bug.cgi?id=313
-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;
}