#!/bin/sh

stalist="$1"
tmp=""
rtm_json_fmt()
{
	tmp="$tmp$*"
}

for mac in $stalist
do
	ip=`cat /proc/net/arp | grep 0x2 | grep $mac | awk -F ' ' '{print $1}'`
	[ "$ip" = "" ] && continue
	rtm_json_fmt "\"$mac\":\""
	host=`cat /tmp/dhcp.leases | grep $mac | awk -F ' ' '{print $4}'`
	rtm_json_fmt "$ip:$host\","
done

bxplug -m csdp:update_stas:"$tmp"

