Commit 307f2285 authored by Leigh B Stoller's avatar Leigh B Stoller

Replace firewall port with iface, snmpit just as happy with node:iface.

parent 867f04b2
...@@ -3253,19 +3253,19 @@ sub IsFirewalled($;$$$) ...@@ -3253,19 +3253,19 @@ sub IsFirewalled($;$$$)
} }
# #
# Get the firewall node name and port number for an experiment; # Get the firewall node name and iface for an experiment;
# e.g., for use in an snmpit call. # e.g., for use in an snmpit call.
# Return 1 if successful, 0 on error. # Return 1 if successful, 0 on error.
# #
sub FirewallAndPort($$$) sub FirewallAndIface($$$)
{ {
my ($self, $fwnodep, $fwportp) = @_; my ($self, $fwnodep, $fwifacep) = @_;
# Must be a real reference. # Must be a real reference.
return -1 return -1
if (! ref($self)); if (! ref($self));
TBExptFirewallAndPort($self->pid(), $self->eid(), $fwnodep, $fwportp) TBExptFirewallAndPort($self->pid(), $self->eid(), $fwnodep, $fwifacep)
or return -1; or return -1;
return 0; return 0;
} }
......
#!/usr/bin/perl -w #!/usr/bin/perl -w
# #
# Copyright (c) 2009-2014 University of Utah and the Flux Group. # Copyright (c) 2009-2017 University of Utah and the Flux Group.
# #
# {{{EMULAB-LICENSE # {{{EMULAB-LICENSE
# #
...@@ -541,14 +541,14 @@ done: ...@@ -541,14 +541,14 @@ done:
my $op; my $op;
if ($doall) { if ($doall) {
my $fwport; my $fwiface;
if ($experiment->FirewallAndPort(\$fwnode, \$fwport) != 0 || if ($experiment->FirewallAndIface(\$fwnode, \$fwiface) != 0 ||
system("$SNMPIT -d ${fwnode}:${fwport}") != 0) { system("$SNMPIT -d ${fwnode}:${fwiface}") != 0) {
push(@fwstate, push(@fwstate,
"Firewall cnet interface ${fwnode}:${fwport} NOT disabled"); "Firewall cnet interface ${fwnode}:${fwiface} NOT disabled");
} else { } else {
push(@fwstate, push(@fwstate,
"Firewall cnet interface ${fwnode}:${fwport} disabled"); "Firewall cnet interface ${fwnode}:${fwiface} disabled");
} }
$experiment->SetPanicBit(2); $experiment->SetPanicBit(2);
$op = "Swapout"; $op = "Swapout";
...@@ -600,9 +600,9 @@ sub Panic($$$) ...@@ -600,9 +600,9 @@ sub Panic($$$)
my $eid = $experiment->eid(); my $eid = $experiment->eid();
my $firewalled = $experiment->IsFirewalled(); my $firewalled = $experiment->IsFirewalled();
my ($firewall, $port); my ($firewall, $iface);
if ($firewalled) { if ($firewalled) {
if ($experiment->FirewallAndPort(\$firewall, \$port) != 0) { if ($experiment->FirewallAndIface(\$firewall, \$iface) != 0) {
print STDERR "Could not determine firewall port for $experiment\n"; print STDERR "Could not determine firewall port for $experiment\n";
return -1; return -1;
} }
...@@ -728,7 +728,7 @@ sub Panic($$$) ...@@ -728,7 +728,7 @@ sub Panic($$$)
else { else {
print "Enabling the control network ...\n"; print "Enabling the control network ...\n";
if ($firewalled) { if ($firewalled) {
system("$SNMPIT -e ${firewall}:${port}"); system("$SNMPIT -e ${firewall}:${iface}");
} }
else { else {
system("$SNMPIT -R $pid $eid"); system("$SNMPIT -R $pid $eid");
...@@ -779,7 +779,7 @@ sub Panic($$$) ...@@ -779,7 +779,7 @@ sub Panic($$$)
level2: level2:
print "Disabling the control network ...\n"; print "Disabling the control network ...\n";
if ($firewalled) { if ($firewalled) {
system("$SNMPIT -d ${firewall}:${port}"); system("$SNMPIT -d ${firewall}:${iface}");
} }
else { else {
system("$SNMPIT -D $pid $eid"); system("$SNMPIT -D $pid $eid");
......
...@@ -65,7 +65,7 @@ use vars qw(@ISA @EXPORT); ...@@ -65,7 +65,7 @@ use vars qw(@ISA @EXPORT);
TBExptIsElabInElab TBExptIsPlabInElab TBExptIsElabInElab TBExptIsPlabInElab
TBExptPlabInElabPLC TBExptPlabInElabNodes TBExptPlabInElabPLC TBExptPlabInElabNodes
TBBatchUnLockExp TBExptIsBatchExp TBBatchUnLockExp TBExptIsBatchExp
TBExptFirewall TBNodeFirewall TBExptFirewallAndPort TBExptFirewall TBNodeFirewall TBExptFirewallAndIface
TBSetExptFirewallVlan TBClearExptFirewallVlan TBSetExptFirewallVlan TBClearExptFirewallVlan
TBNodeConsoleTail TBExptGetSwapoutAction TBExptGetSwapState TBNodeConsoleTail TBExptGetSwapoutAction TBExptGetSwapState
TBNodeSubNodes TBNodeSubNodes
...@@ -2196,27 +2196,26 @@ sub TBExptFirewall ($$;$$$$) { ...@@ -2196,27 +2196,26 @@ sub TBExptFirewall ($$;$$$$) {
} }
# #
# Get the firewall node name and port number for an experiment; # Get the firewall node name and iface for an experiment;
# e.g., for use in an snmpit call. # e.g., for use in an snmpit call.
# Return 1 if successful, 0 on error. # Return 1 if successful, 0 on error.
# #
sub TBExptFirewallAndPort($$$$) { sub TBExptFirewallAndIface($$$$) {
my ($pid, $eid, $fwnodep, $fwportp) = @_; my ($pid, $eid, $fwnodep, $fwifacep) = @_;
my $fwnode; my $fwnode;
require Interface;
if (!TBExptFirewall($pid, $eid, \$fwnode)) { if (!TBExptFirewall($pid, $eid, \$fwnode)) {
return 0; return 0;
} }
my $query_result = my $interface = Interface->LookupControl($fwnode);
DBQueryWarn("select card1 from wires ". if (!defined($interface)) {
"where node_id1='$fwnode' AND type='Control'"); print STDERR "*** Could not lookup control interface for $fwnode\n";
if (!$query_result || !$query_result->numrows) {
return 0; return 0;
} }
$$fwnodep = $fwnode; $$fwnodep = $fwnode;
($$fwportp) = $query_result->fetchrow_array(); ($$fwifacep) = $interface->iface();
return 1; return 1;
} }
......
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