X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=pod.src;fp=pod.src;h=057e8b1fc2f65ae35115a6bc063105d6a68d7d5a;hb=93f0412887322c8f7f38ec71d6a57d5b3ddd9260;hp=0000000000000000000000000000000000000000;hpb=2df2fbe518d5a221ce6e3ee88a3fb23fb1b94b27;p=pingofdeath.git diff --git a/pod.src b/pod.src new file mode 100755 index 0000000..057e8b1 --- /dev/null +++ b/pod.src @@ -0,0 +1,122 @@ +#! /bin/bash +#include INTEL_LICENSE.txt +# +######################################################################## +# +# PlanetLab Ping Of Death +# +######################################################################## +# +# DESCRIPTION +# +# This shell script takes care of starting and stopping Planetlab +# Ping-Of-Death. +# +# The Planetlab POD is a Linux kernel patch that creates the feature +# of resetting and rebooting a computer when a particularily +# formatted ICMP "ping" commmand is received. +# +# A PlanetLab node's kernel gets a host, mask and hash value through +# sysctl's that are performed on the node. The node then looks +# for an ICMP packet from a host matching the host/mask and, if the +# packet payload is the hash value, the node forces an immediate +# reboot. +# +# HISTORY +# +# May 17, 2003 - Paul Brett +# Initial version based on the work of +# Robert Adams and EMULAB +# +# chkconfig: - 11 99 +# description: enable Ping of Death + +# Source function library. +. /etc/init.d/functions + +# Source networking configuration. +. /etc/sysconfig/network + +#include enable_pod.sh +#include disable_pod.sh +#include status_pod.sh + +echo -n "PlanetLab Ping Of Death " + +CONF=/etc/ipod.conf + +if [[ -r $CONF ]] +then + # load the POD configuration file + . $CONF +else + # no POD configuration file - failed + echo + action $"Missing configuration file $CONF" /bin/false + exit 1 +fi + +# Check that networking is up. +if [[ ${NETWORKING} = "no" ]] +then + action $"" /bin/false + exit 1 +fi + +# Check the POD parameters +if [[ "$HASH" == "" ]] +then + echo + action $"Missing HASH in $CONF" /bin/false + exit 1 +fi + +if [[ "$IP_SUBNET" == "" ]] +then + echo + action $"Missing IP_SUBNET in $CONF" /bin/false + exit 1 +fi + +if [[ "$IP_MASK" == "" ]] +then + echo + action $"Missing IP_MASK in $CONF" /bin/false + exit 1 +fi + +# See how we were called. +case "$1" in + start) + enable_pod $IP_SUBNET $IP_MASK $IP_HASH + RETVAL=$? + if [[ $RETVAL -eq 0 ]] + then + action $"" /bin/true + else + action $"" /bin/false + fi + ;; + stop) + disable_pod + RETVAL=$? + if [[ $RETVAL -eq 0 ]] + then + action $"" /bin/true + else + action $"" /bin/false + fi + ;; + status) + status_pod + RETVAL=$? + ;; + restart|reload) + disable_pod + enable_pod + RETVAL=$? + ;; + *) + echo $"Usage: $0 {start|stop|restart|status}" + exit 1 +esac