Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
emulab
emulab-devel
Commits
38452552
Commit
38452552
authored
Dec 18, 2002
by
Leigh B. Stoller
Browse files
Remove old setipod script, which has been replaced by new rc.ipod
which Mike added.
parent
759f2431
Changes
1
Hide whitespace changes
Inline
Side-by-side
tmcd/freebsd/setipod
deleted
100755 → 0
View file @
759f2431
#!/usr/bin/perl -w
#
# EMULAB-COPYRIGHT
# Copyright (c) 2000-2002 University of Utah and the Flux Group.
# All rights reserved.
#
#
# Enable ICMP ping-of-death
# Support both the old style (host only) and the new style (host+mask+key)
#
use
English
;
use
Socket
;
#
# This is in its own file cause its a pain on the MFS, which does not
# have all the that perl library stuff that Socket needs.
#
#
# Untaint path
#
$ENV
{'
PATH
'}
=
"
/bin:/sbin:/usr/bin:/usr/local/bin
";
$ENV
{'
PATH
'}
.=
"
:/usr/local/etc/emulab:/etc/testbed
";
delete
@ENV
{'
IFS
',
'
CDPATH
',
'
ENV
',
'
BASH_ENV
'};
#
# Handle old style
#
if
(
system
("
sysctl -w net.inet.icmp.ipod_enabled=0 >/dev/null 2>&1
")
==
0
)
{
my
(
$bname
,
$bip
)
=
split
(
/ /
,
`
tmcc bossinfo
`);
if
(
!
defined
(
$bip
))
{
warn
"
*** WARNING: could not determine boss node, IPOD not enabled
\n
";
exit
-
1
;
}
my
$ipuint
=
unpack
("
N
",
inet_aton
(
$bip
));
# XXX arg to sysctl must be a signed 32-bit int, so we must "cast"
my
$sysctlcmd
=
sprintf
("
sysctl -w net.inet.icmp.ipod_host=%d
",
$ipuint
);
if
(
system
(
$sysctlcmd
.
"
>/dev/null
"))
{
warn
"
*** WARNING: could not set IPOD host to
$bip
(
$ipuint
)
\n
";
exit
-
1
;
}
if
(
system
("
sysctl -w net.inet.icmp.ipod_enabled=1 >/dev/null
"))
{
warn
"
*** WARNING: could not enable IPOD
\n
";
exit
-
1
;
}
else
{
print
STDOUT
"
IPOD enabled from
$bip
\n
";
}
exit
0
;
}
#
# New style
#
if
(
system
("
sysctl -w net.inet.icmp.ipod.enabled=0 >/dev/null 2>&1
"))
{
warn
"
*** WARNING: IPOD sysctls not supported, not enabled
\n
";
exit
-
1
;
}
my
$pat
=
q(HOST=([0-9.]*) MASK=([0-9.]*) HASH=([0-9a-f]*))
;
if
(`
tmcc ipodinfo
`
=~
/$pat/
)
{
my
$ipaddr
=
$
1
;
my
$ipmask
=
$
2
;
my
$hash
=
$
3
;
#
# Note the use of sprintf below.
# We need this to "cast" the arg to a signed 32-bit int for sysctl.
#
my
$ipuint
=
unpack
("
N
",
inet_aton
(
$ipaddr
));
my
$sysctlcmd
=
sprintf
("
sysctl -w net.inet.icmp.ipod.host=%d
",
$ipuint
);
if
(
system
(
$sysctlcmd
.
"
>/dev/null
"))
{
warn
"
*** WARNING: could not set IPOD host to
$ipaddr
(
$ipuint
)
\n
";
exit
-
1
;
}
$ipuint
=
unpack
("
N
",
inet_aton
(
$ipmask
));
$sysctlcmd
=
sprintf
("
sysctl -w net.inet.icmp.ipod.mask=%d
",
$ipuint
);
if
(
system
(
$sysctlcmd
.
"
>/dev/null
"))
{
warn
"
*** WARNING: could not set IPOD mask to
$ipmask
(
$ipuint
)
\n
";
exit
-
1
;
}
$sysctlcmd
=
sprintf
("
sysctl -w net.inet.icmp.ipod.hash=%.32s
",
$hash
);
if
(
system
(
$sysctlcmd
.
"
>/dev/null
"))
{
warn
"
*** WARNING: could not set IPOD hash
\n
";
exit
-
1
;
}
if
(
system
("
sysctl -w net.inet.icmp.ipod.enabled=1 >/dev/null
"))
{
warn
"
*** WARNING: could not enable IPOD
\n
";
exit
-
1
;
}
else
{
print
STDOUT
"
Authenticated IPOD enabled from
$ipaddr
/
$ipmask
\n
";
}
}
else
{
warn
"
*** WARNING: no IPOD info, not enabled
\n
";
}
exit
0
;
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