3 # Enable ICMP ping-of-death. Runs on the target node and sets the
4 # passed parameters into the kernel.
5 # Invocation: pl-podcntl HOSTIP HOSTMASK HASH
7 # -----------------------------------------------------------------
8 # $Header: /shareddata/CVS/planetlab/admin/ipod/pl-podcntl,v 1.2 2003/01/18 01:43:48 radams Exp $
10 # Copyright (c) 2003 Intel Corporation
11 # All rights reserved.
12 # This file is distributed under the terms in the attached INTEL_LICENSE
13 # file. If you do not find this file, a copy can be obtained by
14 # writing to Intel Research Berkeley; Attention: Intel License Inquiry;
15 # 2150 Shattuck Avenue; Berkeley, CA 94704
16 # -----------------------------------------------------------------
18 # Modified from origional EMULAB script. Origional copyright:
20 # Copyright (c) 2000-2002 University of Utah and the Flux Group.
21 # All rights reserved.
23 # Enable ICMP ping-of-death
24 # Support both the old style (host only) and the new style (host+mask+key)
33 # Grotesque sed/awk converts IP addrs into an integer for sysctl
34 if [ x"$IPODHOSTP" != x ]; then
35 IPODHOST=`echo $IPODHOSTP | \
36 sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \2 \3 \4/' | \
37 awk '{ printf "%d\n", $1*16777216+$2*65536+$3*256+$4 }'`
38 IPODMASK=`echo $IPODMASKP | \
39 sed -e 's/\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\)\.\([0-9]*\).*/\1 \2 \3 \4/' | \
40 awk '{ printf "%d\n", $1*16777216+$2*65536+$3*256+$4 }'`
41 IPODKEY=`echo $IPODHASHP | \
42 sed -e 's/\(.*\)/\1/'`
44 echo "IPODHOST = $IPODHOST"
45 echo "IPODMASK = $IPODMASK"
46 echo "IPODKEY = $IPODKEY"
48 # figure out the version
49 version=`$SYSCTL net.ipv4.icmp_ipod_version 2>/dev/null`
50 if [ "$version"x = x ]; then
51 $SYSCTL net.ipv4.icmp_ipod_enabled >/dev/null 2>&1
62 echo "Version = $version"
66 echo "*** WARNING: no IPOD sysctls, not enabled"
70 $SYSCTL -w net.ipv4.icmp_ipod_host=$IPODHOST >/dev/null
71 $SYSCTL -w net.ipv4.icmp_ipod_enabled=1 >/dev/null
75 $SYSCTL -w net.ipv4.icmp_ipod_host=$IPODHOST >/dev/null
77 $SYSCTL -w net.ipv4.icmp_ipod_mask=$IPODMASK >/dev/null
78 $SYSCTL -w net.ipv4.icmp_ipod_key=$IPODKEY >/dev/null
79 $SYSCTL -w net.ipv4.icmp_ipod_enabled=1 >/dev/null
83 echo Success = $Success
84 if [[ $Success -eq 0 ]] ; then
85 IPODHOST=`echo $IPODINFO | \
86 sed -e 's/.*HOST=\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/'`
87 IPODMASK=`echo $IPODINFO | \
88 sed -e 's/.*MASK=\([0-9]*\.[0-9]*\.[0-9]*\.[0-9]*\).*/\1/'`
89 echo "$str IPOD enabled from $IPODHOST/$IPODMASK"
91 echo "*** WARNING: could not set IPOD info, not enabled"
94 echo "*** WARNING: no IPOD info, not enabled"