Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
7
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emulab
emulab-devel
Commits
307f2285
Commit
307f2285
authored
Aug 18, 2017
by
Leigh B Stoller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace firewall port with iface, snmpit just as happy with node:iface.
parent
867f04b2
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
23 additions
and
24 deletions
+23
-24
db/Experiment.pm.in
db/Experiment.pm.in
+4
-4
db/Firewall.pm.in
db/Firewall.pm.in
+10
-10
db/libdb.pm.in
db/libdb.pm.in
+9
-10
No files found.
db/Experiment.pm.in
View file @
307f2285
...
...
@@ -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
.
#
Return
1
if
successful
,
0
on
error
.
#
sub
FirewallAnd
Port
($$$)
sub
FirewallAnd
Iface
($$$)
{
my
($
self
,
$
fwnodep
,
$
fw
port
p
)
=
@
_
;
my
($
self
,
$
fwnodep
,
$
fw
iface
p
)
=
@
_
;
#
Must
be
a
real
reference
.
return
-
1
if
(
! ref($self));
TBExptFirewallAndPort
($
self
->
pid
(),
$
self
->
eid
(),
$
fwnodep
,
$
fw
port
p
)
TBExptFirewallAndPort
($
self
->
pid
(),
$
self
->
eid
(),
$
fwnodep
,
$
fw
iface
p
)
or
return
-
1
;
return
0
;
}
...
...
db/Firewall.pm.in
View file @
307f2285
#
!/usr/bin/perl -w
#
#
Copyright
(
c
)
2009
-
201
4
University
of
Utah
and
the
Flux
Group
.
#
Copyright
(
c
)
2009
-
201
7
University
of
Utah
and
the
Flux
Group
.
#
#
{{{
EMULAB
-
LICENSE
#
...
...
@@ -541,14 +541,14 @@ done:
my
$
op
;
if
($
doall
)
{
my
$
fw
port
;
if
($
experiment
->
FirewallAnd
Port
(\$
fwnode
,
\$
fw
port
)
!= 0 ||
system
(
"$SNMPIT -d ${fwnode}:${fw
port
}"
)
!= 0) {
my
$
fw
iface
;
if
($
experiment
->
FirewallAnd
Iface
(\$
fwnode
,
\$
fw
iface
)
!= 0 ||
system
(
"$SNMPIT -d ${fwnode}:${fw
iface
}"
)
!= 0) {
push
(@
fwstate
,
"Firewall cnet interface ${fwnode}:${fw
port
} NOT disabled"
);
"Firewall cnet interface ${fwnode}:${fw
iface
} NOT disabled"
);
}
else
{
push
(@
fwstate
,
"Firewall cnet interface ${fwnode}:${fw
port
} disabled"
);
"Firewall cnet interface ${fwnode}:${fw
iface
} disabled"
);
}
$
experiment
->
SetPanicBit
(
2
);
$
op
=
"Swapout"
;
...
...
@@ -600,9 +600,9 @@ sub Panic($$$)
my
$
eid
=
$
experiment
->
eid
();
my
$
firewalled
=
$
experiment
->
IsFirewalled
();
my
($
firewall
,
$
port
);
my
($
firewall
,
$
iface
);
if
($
firewalled
)
{
if
($
experiment
->
FirewallAnd
Port
(\$
firewall
,
\$
port
)
!= 0) {
if
($
experiment
->
FirewallAnd
Iface
(\$
firewall
,
\$
iface
)
!= 0) {
print
STDERR
"Could not determine firewall port for $experiment
\n
"
;
return
-
1
;
}
...
...
@@ -728,7 +728,7 @@ sub Panic($$$)
else
{
print
"Enabling the control network ...
\n
"
;
if
($
firewalled
)
{
system
(
"$SNMPIT -e ${firewall}:${
port
}"
);
system
(
"$SNMPIT -e ${firewall}:${
iface
}"
);
}
else
{
system
(
"$SNMPIT -R $pid $eid"
);
...
...
@@ -779,7 +779,7 @@ sub Panic($$$)
level2
:
print
"Disabling the control network ...
\n
"
;
if
($
firewalled
)
{
system
(
"$SNMPIT -d ${firewall}:${
port
}"
);
system
(
"$SNMPIT -d ${firewall}:${
iface
}"
);
}
else
{
system
(
"$SNMPIT -D $pid $eid"
);
...
...
db/libdb.pm.in
View file @
307f2285
...
...
@@ -65,7 +65,7 @@ use vars qw(@ISA @EXPORT);
TBExptIsElabInElab
TBExptIsPlabInElab
TBExptPlabInElabPLC
TBExptPlabInElabNodes
TBBatchUnLockExp
TBExptIsBatchExp
TBExptFirewall
TBNodeFirewall
TBExptFirewallAnd
Port
TBExptFirewall
TBNodeFirewall
TBExptFirewallAnd
Iface
TBSetExptFirewallVlan
TBClearExptFirewallVlan
TBNodeConsoleTail
TBExptGetSwapoutAction
TBExptGetSwapState
TBNodeSubNodes
...
...
@@ -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
.
#
Return
1
if
successful
,
0
on
error
.
#
sub
TBExptFirewallAnd
Port
($$$$)
{
my
($
pid
,
$
eid
,
$
fwnodep
,
$
fw
port
p
)
=
@
_
;
sub
TBExptFirewallAnd
Iface
($$$$)
{
my
($
pid
,
$
eid
,
$
fwnodep
,
$
fw
iface
p
)
=
@
_
;
my
$
fwnode
;
require
Interface
;
if
(
!TBExptFirewall($pid, $eid, \$fwnode)) {
return
0
;
}
my
$
query_result
=
DBQueryWarn
(
"select card1 from wires "
.
"where node_id1='$fwnode' AND type='Control'"
);
if
(
!$query_result || !$query_result->numrows) {
my
$
interface
=
Interface
->
LookupControl
($
fwnode
);
if
(
!defined($interface)) {
print
STDERR
"*** Could not lookup control interface for $fwnode
\n
"
;
return
0
;
}
$$
fwnodep
=
$
fwnode
;
($$
fw
port
p
)
=
$
query_result
->
fetchrow_array
();
($$
fw
iface
p
)
=
$
interface
->
iface
();
return
1
;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment