the some code from EMULAB to generate and transmit the packet.
No reason to invent something new.
-The remote execution (ssh commands) are all done as "idsl1".
-
Contolling host tools:
-pl-podset: set the host and hash on a remote node
- Call: pl-podset hostIP maskIP targetName
- Uses ssh to call 'pl-podcntl' on the remote node to
- set the host and hash in that node. Also saves the
- information into the file './HashFile'.
-pl-podzap: send ICMP packet to node to resetit
- Call: pl-podzap targetName
- Fetches parameters from the file './HashFile' and
- calls 'pl-poddoit' on the 'hostIP' machine to send the
- reset ICMP packet to the specified target node.
- Note that this relies on the planetlab node that
- was specified in the 'pl-podset' command to actually
- do the packet transmission.
-pl-poddoit: send the ICMP packet (called by 'pl-podzap')
- Routine that constructs an ICMP packet of the proper
- format and send it to the node.
-
-Planetlab node scripts:
-pl-podcntl: set the host and hash into the kernel
- Call: pl-podcntl hostIP maskIP hashValue
- Sets the specified values into the kernel and enables
- the POD filtering operation.
-
-EXAMPLE
--------
-Setting a node to be able to reset (assuming running on 123.123.12.23):
- pl-podset 123.123.12.23 255.255.255.255 planetlab-1.stanford.edu
-
-To later reset the node (command performed on 123.123.12.23):
- pl-podzap planetlab-1.stanford.edu
+pod.py Used to send both ICMP and UDP based POD packets. Requires
+ the hostname to send the packet do, and the configured
+ hash/key for the specified node.
%define name ipod
-%define version 2.1
+%define version 2.2
%define release 1%{?pldistro:.%{pldistro}}%{?date:.%{date}}
Vendor: PlanetLab
Distribution: PlanetLab 3.0
URL: http://cvs.planet-lab.org/cvs/ipod
-Summary: PlanetLab ICMP Ping of Death
+Summary: PlanetLab ICMP/UDP Ping of Death
Name: %{name}
Version: %{version}
Release: %{release}
%description
Startup service to enable Ping Of Death
+%package client
+Summary: PlanetLab ICMP/UDP Ping of Death Client Tools
+Group: System Environment/Kernel
+Requires: python
+
+%description client
+Client utilities to use Ping of Death
+
%prep
%setup
%install
+# ipod
mkdir -p $RPM_BUILD_ROOT/usr/local/planetlab/bin
mkdir -p $RPM_BUILD_ROOT/etc/init.d
cp pl-poddoit $RPM_BUILD_ROOT/usr/local/planetlab/bin/
cp pod $RPM_BUILD_ROOT/etc/init.d/
+# ipod-client
+mkdir -p $RPM_BUILD_ROOT/usr/bin/
+cp pod.py $RPM_BUILD_ROOT/usr/bin
%clean
[ "$RPM_BUILD_ROOT" != "/" ] && rm -rf $RPM_BUILD_ROOT
/etc/init.d/pod
/usr/local/planetlab/bin/pl-poddoit
+%files client
+%defattr(0755, root, root)
+/usr/bin/pod.py
+
+
%pre
%post
%changelog
+* Wed Jan 11 2006 Aaron Klingaman <alk@absarokasoft.com>
+- add support for building client tool rpm
+
* Fri Aug 5 2005 Aaron Klingaman <alk@absarokasoft.com>
- updated to use new source of POD Hash (/etc/planetlab/session)
- minor build changes to simply build process
+++ /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
-
+++ /dev/null
-#! /bin/bash
-Invocation="pl-podset HOSTIPAddr TARGETIPAddr"
-# Run on a controlling computer to set the pod parameters on a
-# remote node. A hash code is generated and set into the remote
-# node and stored in a local file for later invocation.
-# -----------------------------------------------------------------
-# $Header: /shareddata/CVS/planetlab/admin/ipod/pl-podset,v 1.3 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
-# -----------------------------------------------------------------
-
-HOSTIP=$1
-TARGETIP=$2
-
-if [[ x$HOSTIP == x || x$TARGETIP == x ]] ; then
- echo "Invocation: $Invocation"
- exit 1
-fi
-
-DATEE=`date +%Y%m%d%H%M`
-TEMPFILE="/tmp/HashFile_$RANDOM"
-HASHFILE="./HashFile"
-PLBIN="/usr/local/planetlab/bin"
-
-HASHCODE=`printf "%04x%04x%04x%04x%04x%04x%04x%04x\n" $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM $RANDOM`
-
-#echo "HOSTIP = $HOSTIP"
-#echo "TARGETIP = $TARGETIP"
-#echo "HASHCODE = '$HASHCODE'"
-
-ssh idsl1@$TARGETIP "sudo $PLBIN/pl-podcntl $HOSTIP 255.255.255.255 $HASHCODE"
-
-if [[ -f $HASHFILE ]] ; then
- grep -v "$TARGETIP" $HASHFILE > $TEMPFILE
-else
- touch $HASHFILE
- touch $TEMPFILE
-fi
-echo "$DATEE $HOSTIP $TARGETIP $HASHCODE" >> $TEMPFILE
-mv $HASHFILE $HASHFILE.last
-mv $TEMPFILE $HASHFILE
+++ /dev/null
-#! /bin/bash
-Invocation="pl-podzap TargetHostName"
-# Fetches the hash code from the saved hash code file and commands
-# the specified PlanetLab node to send
-# the properly constructed ICMP message to the remote node to
-# reset it.
-# -----------------------------------------------------------------
-# $Header: /shareddata/CVS/planetlab/admin/ipod/pl-podzap,v 1.4 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, suite 1300; Berkeley, CA 94704
-# -----------------------------------------------------------------
-
-TARGETIP=$1
-
-if [[ x$TARGETIP == x ]] ; then
- echo "Invocation: $Invocation"
- exit 1
-fi
-
-PLBIN="/usr/local/planetlab/bin"
-HASHFILE="./HashFile"
-
-set `grep "$TARGETIP" $HASHFILE`
-DATEE=$1
-HOSTIP=$2
-TARGETIPP=$3
-HASHCODE=$4
-
-if [[ x$HASHCODE != x ]] ; then
- echo "DATEE=$DATEE, HOSTIP=$HOSTIP, TARGETIPP=$TARGETIPP, HASHCODE = '$HASHCODE'"
-
- ssh idsl1@$HOSTIP "echo $HASHCODE | sudo $PLBIN/pl-poddoit -i - $TARGETIP"
-else
- echo "No hash code found for specified target node"
-fi
-