#!/bin/sh
#
# ndppd	       NDP Proxy Daemon
#
# chkconfig: - 47 68
# description:	ndppd, or NDP Proxy Daemon, is a daemon that proxies NDP \
#               (Neighbor Discovery Protocol) messages between interfaces
# processname: ndppd
# config: /etc/ndppd/ndppd.conf
# pidfile: /run/ndppd.pid
#
### BEGIN INIT INFO
# Provides:          ndppd
# Required-Start:    $network $local_fs $remote_fs
# Required-Stop:     $remote_fs
# Default-Start:     2 3 4 5
# Default-Stop:      0 1 6
# Short-Description: NDP Proxy Daemon
# Description:       nppd, or NDP Proxy Daemon, is a daemon that proxies NDP
#                    (Neighbor Discovery Protocol) messages between interfaces.
### END INIT INFO


# Do not load RH compatibility interface.
WITHOUT_RC_COMPAT=1

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

PIDFILE=/run/ndppd.pid
LOCKFILE=/run/lock/subsys/ndppd
RETVAL=0

CONFFILE=/etc/ndppd/ndppd.conf


start()
{
	start_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- /usr/sbin/ndppd -d -c ${CONFFILE} -p ${PIDFILE}
	RETVAL=$?
	return $RETVAL
}

stop()
{
	stop_daemon --pidfile "$PIDFILE" --lockfile "$LOCKFILE" --expect-user root -- /usr/sbin/ndppd
	RETVAL=$?
	return $RETVAL
}

restart()
{
	stop
	start
}

# See how we were called.
case "$1" in
	start)
		start
		;;
	stop)
		stop
		;;
	reload)
		restart
		;;
	restart)
		restart
		;;
	condstop)
		if [ -e "$LOCKFILE" ]; then
			stop
		fi
		;;
	condrestart)
		if [ -e "$LOCKFILE" ]; then
			restart
		fi
		;;
	condreload)
		if [ -e "$LOCKFILE" ]; then
			reload
		fi
		;;
	status)
		status --pidfile "$PIDFILE" --expect-user root -- /usr/sbin/ndppd
		RETVAL=$?
		;;
	*)
		msg_usage "${0##*/} {start|stop|reload|restart|condstop|condrestart|condreload|status}"
		RETVAL=1
esac

exit $RETVAL
