summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStephen Hemminger <stephen.hemminger@vyatta.com>2010-02-16 09:10:05 -0800
committerStephen Hemminger <stephen.hemminger@vyatta.com>2010-02-16 10:24:31 -0800
commitdef0f16b44e005d743a90318a8e425d7bc0f2db0 (patch)
tree01e28ba59e200dffc155bd5756865c5db0d21ea7
parenta3558769859ffc34af994aaebbedae7e7f8aee65 (diff)
downloadvyatta-cfg-system-def0f16b44e005d743a90318a8e425d7bc0f2db0.tar.gz
vyatta-cfg-system-def0f16b44e005d743a90318a8e425d7bc0f2db0.zip
Add syntax check for vif name where non-vif expected
Bug 5331
-rwxr-xr-xscripts/vyatta-interfaces.pl8
1 files changed, 8 insertions, 0 deletions
diff --git a/scripts/vyatta-interfaces.pl b/scripts/vyatta-interfaces.pl
index 3b1473c9..7494d12a 100755
--- a/scripts/vyatta-interfaces.pl
+++ b/scripts/vyatta-interfaces.pl
@@ -490,10 +490,18 @@ sub is_valid_name {
my $intf = new Vyatta::Interface($name);
die "$name does not match any known interface name type\n"
unless $intf;
+
+ my $vif = $intf->vif();
+ die "$name is the name of VIF interface\n" ,
+ "Need to use \"interface ",$intf->physicalDevice()," vif $vif\"\n"
+ if $vif;
+
die "$name is a ", $intf->type(), " interface not an $type interface\n"
if ($type ne 'all' and $intf->type() ne $type);
+
die "$type interface $name does not exist on system\n"
unless grep { $name eq $_ } getInterfaces();
+
exit 0;
}