#!/bin/bash
# Copyright (C) SWsoft, 1999-2007. All rights reserved.
#
# Update VEs arp on interface UP
#

[ ! -f /etc/sysconfig/vz-scripts/vz-functions ] && exit 0
. /etc/sysconfig/vz-scripts/vz-functions

update_arp()
{
	for veip in `awk '($1 > 0) { for(i=4;i<=NF;i++) { print $i; } }' /proc/vz/veinfo`; do
		 /sbin/ip neigh add proxy ${veip} dev ${DEV} > /dev/null 2>&1
	done
}

[ ! -f /proc/vz/veinfo ] && exit 0
vzgetnetdev
DEV=$1
[ -z "${DEV}" -o -z "${NETDEVICES}" ] && exit 0
if ! echo "${NETDEVICES}" | grep -qe "${DEV}"; then
	exit 0
fi
update_arp
exit 0
