Commit 77924ebd authored by Mike Hibler's avatar Mike Hibler

New version to deal with, version MIB. Current version is 2, note that

"hash" has been renamed as "key."  V2 also eliminates the 666 length check.
parent e7e4080e
......@@ -28,34 +28,57 @@ if [ x"$IPODINFO" != x ]; then
IPODMASK=`echo $IPODINFO | \
sed -e 's/.*MASK=\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \2 \3 \4/' | \
awk '{ printf "%d\n", $1*16777216+$2*65536+$3*256+$4 }'`
IPODHASH=`echo $IPODINFO | \
IPODKEY=`echo $IPODINFO | \
sed -e 's/.*HASH=\(.*\)/\1/'`
# See if this is new or old style IPoD
sysctl -w net.inet.icmp.ipod.enabled=0 >/dev/null 2>&1
case $? in
# figure out the version
version=`sysctl net.inet.icmp.ipod.version 2>/dev/null`
if [ "$version"x = x ]; then
sysctl net.inet.icmp.ipod.enabled >/dev/null 2>&1
case $? in
0)
# XXX ick we sorta had a version 1.5 in BSD
sysctl net.inet.icmp.ipod.hash >/dev/null 2>&1
case $? in
0)
version=1.5
;;
*)
version=1
;;
esac
;;
*)
version=0
;;
esac
fi
# enable if possible
case $version in
0)
# new style
echo "*** WARNING: no IPOD sysctls, not enabled"
exit 1
;;
1)
sysctl -w net.inet.icmp.ipod_host=$IPODHOST >/dev/null
sysctl -w net.inet.icmp.ipod_enabled=1 >/dev/null
str="Old-style"
;;
1.5)
sysctl -w net.inet.icmp.ipod.host=$IPODHOST >/dev/null
sysctl -w net.inet.icmp.ipod.mask=$IPODMASK >/dev/null
sysctl -w net.inet.icmp.ipod.hash=$IPODHASH >/dev/null
sysctl -w net.inet.icmp.ipod.hash=$IPODKEY >/dev/null
sysctl -w net.inet.icmp.ipod.enabled=1 >/dev/null
str="Authenticated"
;;
*)
sysctl -w net.inet.icmp.ipod_enabled=0 >/dev/null 2>&1
case $? in
0)
# old style
sysctl -w net.inet.icmp.ipod_host=$IPODHOST >/dev/null
sysctl -w net.inet.icmp.ipod_enabled=1 >/dev/null
str="Old-style"
;;
*)
# no style
echo "*** WARNING: no IPOD sysctls, not enabled"
exit 1
esac
sysctl -w net.inet.icmp.ipod.host=$IPODHOST >/dev/null
sysctl -w net.inet.icmp.ipod.mask=$IPODMASK >/dev/null
sysctl -w net.inet.icmp.ipod.key=$IPODKEY >/dev/null
sysctl -w net.inet.icmp.ipod.enabled=1 >/dev/null
str="Authenticated"
;;
esac
IPODHOST=`echo $IPODINFO | \
sed -e 's/.*HOST=\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/'`
......
......@@ -5,6 +5,8 @@
# All rights reserved.
#
. /etc/emulab/paths.sh
#
# Enable ICMP ping-of-death
# Support both the old style (host only) and the new style (host+mask+key)
......@@ -13,12 +15,6 @@
# in the frisbee MFS which does not include perl.
#
if [ -r /etc/emulab/paths.sh ]; then
. /etc/emulab/paths.sh
else
BINDIR=/etc/rc.d/testbed
fi
# Grotesque sed/awk converts IP addrs into an integer for sysctl
IPODINFO=`$BINDIR/tmcc ipodinfo`
if [ x"$IPODINFO" != x ]; then
......@@ -28,35 +24,41 @@ if [ x"$IPODINFO" != x ]; then
IPODMASK=`echo $IPODINFO | \
sed -e 's/.*MASK=\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \2 \3 \4/' | \
awk '{ printf "%d\n", $1*16777216+$2*65536+$3*256+$4 }'`
IPODHASH=`echo $IPODINFO | \
IPODKEY=`echo $IPODINFO | \
sed -e 's/.*HASH=\(.*\)/\1/'`
# old style or new style? old style doesn't have mask/hash
sysctl net.ipv4.icmp_ipod_mask >/dev/null 2>&1
case $? in
0)
# new style
sysctl -w net.ipv4.icmp_ipod_host=$IPODHOST >/dev/null
sysctl -w net.ipv4.icmp_ipod_mask=$IPODMASK >/dev/null
sysctl -w net.ipv4.icmp_ipod_hash=$IPODHASH >/dev/null
sysctl -w net.ipv4.icmp_ipod_enabled=1 >/dev/null
str="Authenticated"
;;
*)
# old style or no support?
# figure out the version
version=`sysctl net.ipv4.icmp_ipod_version 2>/dev/null`
if [ "$version"x = x ]; then
sysctl net.ipv4.icmp_ipod_enabled >/dev/null 2>&1
case $? in
0)
# old style
sysctl -w net.ipv4.icmp_ipod_host=$IPODHOST >/dev/null
sysctl -w net.ipv4.icmp_ipod_enabled=1 >/dev/null
str="Old-style"
version=1
;;
*)
# no style
echo "*** WARNING: no IPOD sysctls, not enabled"
exit 1
version=0
;;
esac
fi
# enable if possible
case $version in
0)
echo "*** WARNING: no IPOD sysctls, not enabled"
exit 1
;;
1)
sysctl -w net.ipv4.icmp_ipod_host=$IPODHOST >/dev/null
sysctl -w net.ipv4.icmp_ipod_enabled=1 >/dev/null
str="Old-style"
;;
*)
sysctl -w net.ipv4.icmp_ipod_host=$IPODHOST >/dev/null
sysctl -w net.ipv4.icmp_ipod_mask=$IPODMASK >/dev/null
sysctl -w net.ipv4.icmp_ipod_key=$IPODKEY >/dev/null
sysctl -w net.ipv4.icmp_ipod_enabled=1 >/dev/null
str="Authenticated"
;;
esac
IPODHOST=`echo $IPODINFO | \
sed -e 's/.*HOST=\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\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