From f6bf877bf5a90c342dcc8f4ce6a2fdd5e597c4d7 Mon Sep 17 00:00:00 2001 From: Saurabh Mohan Date: Mon, 16 Jul 2012 14:09:32 -0700 Subject: Workaround to setup vti ko and cleaner error message. --- scripts/vyatta-vti-config.pl | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'scripts') diff --git a/scripts/vyatta-vti-config.pl b/scripts/vyatta-vti-config.pl index 57fded4..cbbde32 100755 --- a/scripts/vyatta-vti-config.pl +++ b/scripts/vyatta-vti-config.pl @@ -123,6 +123,11 @@ if (@peers == 0) { print STDERR "$vti_cfg_err Invalid local-address \"$lip\".\n"; exit -1; } + # Check tunName is valid. + if (!defined($tunName) || $tunName eq "" || ! $vcIntf->exists("vti $tunName") ) { + print STDERR "$vti_cfg_err Invalid tunnel name vti \"$tunName\".\n"; + exit -1; + } # Check mark is valid. if (!defined($mark)) { print STDERR "$vti_cfg_err mark not defined.\n"; @@ -132,11 +137,6 @@ if (@peers == 0) { print STDERR "$vti_cfg_err Invalid mark \"$mark\".\n"; exit -1; } - # Check tunName is valid. - if (!defined($tunName) || $tunName eq "" || ! $vcIntf->exists("vti $tunName") ) { - print STDERR "$vti_cfg_err Invalid tunnel name vti \"$tunName\".\n"; - exit -1; - } # # Get the tunnel parameters. # @@ -156,8 +156,8 @@ if (@peers == 0) { # Set the configuration into the output string. # # By default we delete the tunnel... - $gencmds .= "sudo /sbin/ip link delete $tunName type vti &> /dev/null\n"; - $gencmds .= "sudo /sbin/ip link add $tunName type vti key $mark remote $peer local $lip\n"; + $gencmds .= "sudo /sbin/ip link delete $tunName &> /dev/null\n"; + $gencmds .= "sudo /opt/vyatta/sbin/cfgvti add name $tunName key $mark remote $peer local $lip\n"; foreach my $tunIP (@tunIPs) { $gencmds .= "sudo /sbin/ip addr add $tunIP dev $tunName\n"; } -- cgit v1.2.3