#!/bin/sh

# This script is called by IPwatchD daemon when IP conflict occurs.
# This script will include /etc/ipwatchd/user-script.
# You can edit /etc/ipwatchd/user-script to suite your need.

# Name of network device in conflict
DEVICE=$1

# IP address in conflict
IP=$2

# MAC address of conflicting system
MAC=$3

USER_SCRIPT=/etc/ipwatchd/user-script

# Run notification tool for Gnome environment
if [ -x /usr/sbin/ipwatchd-gnotify ]; then
	/usr/sbin/ipwatchd-gnotify \
		--broadcast \
		--title "IP conflict occurred" \
		--message "MAC address $MAC causes IP conflict with address $IP set on interface $DEVICE"
fi

if [ -f ${USER_SCRIPT} ]; then
	. ${USER_SCRIPT}
fi

exit 0

