All new accounts created on Gitlab now require administrator approval. If you invite any collaborators, please let Flux staff know so they can approve the accounts.

Commit 1823b34c authored by Mac Newbold's avatar Mac Newbold

Fixed "FailUpdating" bug, made fatal errors go to STDERR, everything else

to STDOUT. Basically, improved compatibility with tbrun.
parent 3aca822b
......@@ -6,12 +6,14 @@
# Run with -h option to see command line syntax/options. #
# #
# Author: Mac Newbold, Flux Research Group, University of Utah #
# Last Change: May 23, 2000 #
# Version: 1.11 #
# Last Change: July 21, 2000 #
# Version: 1.12 #
# #
#########################################################################
my $debug = 0;
#If there is debug, turn it on right now...
if ( join(" ",@ARGV) =~ /-debug/ ) { $debug = 1; }
&myMain;
......@@ -590,7 +592,7 @@ sub UpdateField {
if $debug;
$Status = $session->get([[$OID,$port]]);
if (!defined $Status) {
print "Port $port, change to $val: No answer from device\n";
print STDERR "Port $port, change to $val: No answer from device\n";
} else {
print "Value for $port was $Status\n" if ($v);
if ($Status ne $val) {
......@@ -697,16 +699,17 @@ sub GetToken {
my $TokenReqResult = '.1.3.6.1.4.1.343.6.11.4.7';
my $TokenRelease = '.1.3.6.1.4.1.343.6.11.4.8';
my $TokenReleaseResult = '.1.3.6.1.4.1.343.6.11.4.9';
my $Num = pack("C*",0,0,0,0,1,1);
#The zeros and ones are a magic number it needs...
$sess->set([[$TokenReq,0,$Num,"OCTETSTR"]]);
my $RetVal = $sess->get([[$TokenReqResult,0]]);
my $Num = pack("C*",0,0,0,0,1,1);
my $RetVal = 0;
my $tries = 0;
while ($RetVal ne "success" && $tries < 10) {
$tries += 1;
$sess->set([[$TokenReq,0,$Num,"OCTETSTR"]]);
$RetVal = $sess->get([[$TokenReqResult,0]]);
while ($RetVal eq "notReady") {
$RetVal = $sess->get([[$TokenReqResult,0]]);
print "VLAN Token Claim Result is $RetVal\n" if ($v);
print "*VLAN Token Claim Result is $RetVal\n" if ($v);
select (undef, undef, undef, .25); #wait 1/4 second
}
print "VLAN Token Claim Result is $RetVal\n" if ($v);
......@@ -715,14 +718,15 @@ sub GetToken {
if ($Owner ne "0.0.0.0") {
$tries = 10;
} else {
print time,"Try #$tries - Result is $RetVal - Waiting 10 seconds\n";
select (undef, undef, undef, 10); #wait 5 seconds
print STDERR time,
"Try #$tries - Result is $RetVal - Waiting 2 seconds\n";
select (undef, undef, undef, 2); #wait 2 seconds
}
}
}
if ($RetVal ne 'success') {
my $Owner = $sess->get([[$TokenOwner,0]]);
print "VLAN Token Claim Result is $RetVal\n";
print STDERR "VLAN Token Claim Result is $RetVal\n";
die("Can't edit VLANs: Token taken by $Owner\n");
}
}
......@@ -865,7 +869,7 @@ sub ReadTranslationTable {
open(FILE,"/home/newbold/switch/macslist")
|| die("Couldn't open /home/newbold/switch/macslist\n");
} else {
print "Couldn't locate macslist configuration file.\n",
print STDERR "Couldn't locate macslist configuration file.\n",
"Translation of MAC addresses will be disabled.\n";
return 0;
}
......@@ -883,7 +887,6 @@ sub ReadTranslationTable {
} else {
$switchport = "";
}
#print "$name <==> $mac <==> $switchport\n";
$Table{$name} = $mac;
$Table{$mac} = $name;
}
......@@ -954,12 +957,12 @@ sub RemoveVLAN {
my $RetVal = "Undef.";
print " Removing VLAN #$r ... ";
if ($r == 24) {
print "VLAN #$r is the Control VLAN, and cannot be removed.\n";
print STDERR "VLAN #$r is the Control VLAN, and cannot be removed.\n";
} else {
$RetVal = $sess->set([[$DeleteOID,$r,"delete","INTEGER"]]);
print "",($RetVal? "Succeeded":"Failed"),".\n";
if (! defined ($RetVal) ) {
print "VLAN #$r does not exist on this switch.\n";
print STDERR "VLAN #$r does not exist on this switch.\n";
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment