--- /dev/null
+#/bin/sh -
+#
+# Enable ICMP ping-of-death. Runs on the target node and sets the
+# passed parameters into the kernel.
+# Invocation: pl-podcntl HOSTIP HOSTMASK HASH
+
+# -----------------------------------------------------------------
+# $Header: /shareddata/CVS/planetlab/admin/ipod/pl-podcntl,v 1.2 2003/01/18 01:43:48 radams Exp $
+#
+# Copyright (c) 2003 Intel Corporation
+# All rights reserved.
+# This file is distributed under the terms in the attached INTEL_LICENSE
+# file. If you do not find this file, a copy can be obtained by
+# writing to Intel Research Berkeley; Attention: Intel License Inquiry;
+# 2150 Shattuck Avenue; Berkeley, CA 94704
+# -----------------------------------------------------------------
+
+# Modified from origional EMULAB script. Origional copyright:
+# 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)
+#
+
+IPODHOSTP=$1
+IPODMASKP=$2
+IPODHASHP=$3
+
+SYSCTL="/sbin/sysctl"
+
+# Grotesque sed/awk converts IP addrs into an integer for sysctl
+if [ x"$IPODHOSTP" != x ]; then
+ IPODHOST=`echo $IPODHOSTP | \
+ sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \2 \3 \4/' | \
+ awk '{ printf "%d\n", $1*16777216+$2*65536+$3*256+$4 }'`
+ IPODMASK=`echo $IPODMASKP | \
+ sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \2 \3 \4/' | \
+ awk '{ printf "%d\n", $1*16777216+$2*65536+$3*256+$4 }'`
+ IPODKEY=`echo $IPODHASHP | \
+ sed -e 's/\(.*\)/\1/'`
+
+ echo "IPODHOST = $IPODHOST"
+ echo "IPODMASK = $IPODMASK"
+ echo "IPODKEY = $IPODKEY"
+
+ # 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)
+ version=1
+ ;;
+ *)
+ version=0
+ ;;
+ esac
+ fi
+
+ echo "Version = $version"
+ # 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
+ Success=$?
+ $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
+ echo Success = $Success
+ if [[ $Success -eq 0 ]] ; then
+ IPODHOST=`echo $IPODINFO | \
+ sed -e 's/.*HOST=\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/'`
+ IPODMASK=`echo $IPODINFO | \
+ sed -e 's/.*MASK=\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/'`
+ echo "$str IPOD enabled from $IPODHOST/$IPODMASK"
+ else
+ echo "*** WARNING: could not set IPOD info, not enabled"
+ fi
+else
+ echo "*** WARNING: no IPOD info, not enabled"
+fi
+