#!/bin/bash
#
# arpd	This shell script takes care of starting and stopping arpd.
#
# chkconfig: 2345 65 35
# description: arpd -  ARP reply daemon \
# arpd replies to any ARP request for an IP address matching the specified \
# destination net with the hardware MAC address of the specified interface, \
# but only after determining if another host already claims it. \
# probe: false
# processname: arpd
# pidfile: /var/run/arpd.pid
# config: /etc/sysconfig/arpd

# Source function library.
. /etc/rc.d/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

# Check that networking is up.
[ "${NETWORKING}" = "no" ] && exit 0

[ -f /usr/sbin/arpd ] || exit 0

[ -f /etc/sysconfig/arpd ] && . /etc/sysconfig/arpd


# See how we were called.
case "$1" in
start)
	echo -n "Starting arpd: "
	OPTION="";
	if [ -n "$INTERFACE" ]; then
		OPTION=" -i $INTERFACE";
	fi;	
	if [ -n "$IP" ]; then
		OPTION="${OPTION} ${IP}";
	fi;	
	daemon arpd $OPTION
	echo
	touch /var/lock/subsys/arpd
	;;
stop)
	echo -n "Stopping arpd: "
	killproc arpd
	echo
	rm -f /var/lock/subsys/arpd
	;;
status)
	status arpd
	;;
restart|reload)
	$0 stop
	$0 start
	;;
condrestart)
	[ -f /var/lock/subsys/arpd ] && restart
	;;
  *)
	echo "Usage: arpd {start|stop|status|restart|condrestart|reload}"
	exit 1
esac

exit 0
