#!/bin/sh

usage()
{
    echo "This script is intended to be run by the UCARP daemon."
    echo "Usage: $0 <network interface> <IP address> <anything>"
    echo "Usage: $0 <anything> <255.255.255.255> <virtual router ID>"
    exit 1
}

[ $# -eq 3 ] || usage

case $2 in
    255.255.255.255)
        # New-style invocation. Process the the list of addresses
        # specific to this virtual router.
        MYDIR=`dirname $0`
        $MYDIR/vip-helper.sh $3 del
        ;;
    *)
        # Old-style invocation. Just add a single address to the same
        # interface UCARP daemon is working on.
        ip address del $2/32 dev $1
        ;;
esac

