From def0f16b44e005d743a90318a8e425d7bc0f2db0 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 16 Feb 2010 09:10:05 -0800 Subject: Add syntax check for vif name where non-vif expected Bug 5331 --- scripts/vyatta-interfaces.pl | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'scripts') 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; } -- cgit v1.2.3