#!/sbin/runscript # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 # $Header: $ depend() { # If the user set TUNTAP_INTERFACE, they probably have a net script # configuring that interface. icmptx is responsible for actually creating # the stupid thing, so we need to run before the config. if [ ! -z "${TUNTAP_INTERFACE}" ] ; then if [ -x "/etc/init.d/net.${TUNTAP_INTERFACE}" ] ; then before net.${TUNTAP_INTERFACE} fi fi } loadtun() { if [ ! -e /dev/net/tun ] ; then ebegin "Loading TUN/TAP kernel module" modprobe -q tun eend $? fi if [ ! -e /dev/net/tun ] ; then eend 1 "Failed to load TUN driver! (did you compile your kernel with TUN/TAP support?)" return 1 fi return 0 } checkconfig() { [ -z "${SERVER}" ] && eerror "SERVER must be set" } start() { checkconfig || return 1 loadtun || return 1 ebegin "Starting icmptxcd" start-stop-daemon \ --start \ --background \ --make-pidfile \ --exec /usr/sbin/icmptx \ --pidfile "/run/icmptx.pid" \ -- -c ${SERVER} eend $? } stop() { ebegin "Stopping icmptxcd" start-stop-daemon \ --stop \ --exec /usr/sbin/icmptx \ --pidfile "/run/icmptx.pid" eend $? }