#!/bin/bash # # Init file for the LLTD daemon [ -x /usr/sbin/lld2d ] || exit 0 [ -r /etc/lld2d.conf ] || exit 0 # Get the configuration information from /etc/rc.d/rc.inet1.conf: . /etc/rc.d/rc.inet1.conf # Compose a list of interfaces from /etc/rc.d/rc.inet1.conf (with a maximum # of 6 interfaces. (Routine from .etc/rc.d/rc.inet1) MAXNICS=${MAXNICS:-6} IFACES="" i=0 while [ $i -lt $MAXNICS ]; do if [ ! -z "${IPADDR[$i]}" ] || [ ! -z "${USE_DHCP[$i]}" ]; then IFACES="${IFACES} ${IFNAME[$i]:=eth${i}}" fi i=$(($i+1)) done # Search for VDE2 tap interfaces if [ -x /etc/rc.d/rc.vde2 ] && [ -f /etc/rc.d/rc.vde2.conf ]; then . /etc/rc.d/rc.vde2.conf i=0 while [ $i -lt 4 ]; do if [ ! -z "${VDENAME[$i]}" ] && [ -n "${TAPNAME[$i]}" ]; then IFACES="${IFACES} ${TAPNAME[$i]}" fi i=$(($i+1)) done fi # Or, define the interfaces yourself. Never include the WAN interface! #IFACES="eth0 eth1" start() { echo -n "Starting LLTD: " /usr/bin/rm -f /var/run/lld2d-*.pid /usr/sbin/lld2d $IFACES echo "/usr/sbin/lld2d $IFACES" } stop() { echo -n "Stopping LLTD: " /bin/killall /usr/sbin/lld2d /usr/bin/rm -f /var/run/lld2d-*.pid echo } restart(){ stop sleep .5 start } case "$1" in start) start ;; stop) stop ;; restart) restart ;; reload) restart ;; *) echo "Usage: $0 {start|stop|restart}" esac exit 0