4 # description: The arpwatch daemon attempts to keep track of ethernet/ip \
6 # processname: arpwatch
8 # Source function library
9 . /etc/rc.d/init.d/functions
12 . /etc/sysconfig/network
18 [ -f /etc/sysconfig/arpwatch ] && . /etc/sysconfig/arpwatch
20 # Check that networking is up.
21 if is_yes "${NETWORKING}"; then
22 if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
23 msg_network_down "arpwatch"
30 if is_yes "${NO_BOGON}"; then
31 GLOBAL_OPTIONS="$GLOBAL_OPTIONS -N"
33 if [ -n "${LOCAL_NETWORKS}" ]; then
34 for i in ${LOCAL_NETWORKS}; do
35 GLOBAL_OPTIONS="$GLOBAL_OPTIONS -n $i"
41 # See how we were called.
44 # Check if the service is already running?
45 if [ ! -f /var/lock/subsys/arpwatch ]; then
46 if [ -z "$INTERFACES" ]; then
47 INTERFACES="`/sbin/ip link show \
48 | egrep '^[^ ].*' |egrep -v "NOARP|LOOPBACK" \
49 |sed 's/[0-9]*: \([a-zA-Z0-9]*\)[@:].*/\1/'|xargs`"
51 [ ! -z "$NETWORKS" ] && NETWORKS="-n $NETWORKS"
52 for IFC in $INTERFACES; do
53 msg_starting "arpwatch ($IFC)"
54 touch /var/lib/arpwatch/$IFC.dat
55 chown 2:2 /var/lib/arpwatch/$IFC.dat
56 OPTIONS="$GLOBAL_OPTIONS"
57 if ! is_yes "${NO_BOGON}"; then
58 eval IF_LOCAL_NETWORKS=\$${IFC}_LOCAL_NETWORKS
59 if [ -n "${IF_LOCAL_NETWORKS}" ]; then
60 for i in ${IF_LOCAL_NETWORKS}; do
61 OPTIONS="$OPTIONS -n $i"
65 daemon arpwatch $NETWORKS -i $IFC -f /var/lib/arpwatch/$IFC.dat -u daemon $OPTIONS
67 [ $RETVAL -eq 0 ] && touch /var/lock/subsys/arpwatch
70 msg_already_running "arpwatch"
74 if [ -f /var/lock/subsys/arpwatch ]; then
75 msg_stopping "arpwatch"
77 rm -f /var/lock/subsys/arpwatch >/dev/null 2>&1
79 msg_not_running "arpwatch"
92 msg_usage "$0 {start|stop|restart|force-reload|status}"