#!/bin/sh

mdns_result_file="/tmp/mdns_ipv4_result"

#get information
my_mac=$(echo `uci get wireless.2g.macAddr` | awk '{print $NF}')
[ "x$my_mac" = "x" ]
    my_mac=$(ifconfig ra0 | grep HWaddr | awk '{print $NF}')
my_ip="`ifconfig br-lan | grep Bcast | cut -d ' ' -f 12|cut -c 6-`"
my_name=$(echo `uci get system.@system[0].hostname`)
[ "x$my_name" = "x" ] && my_name="EAX17"

#delete old entry
eval "sed -i '/$my_mac /d' $mdns_result_file"
#insert new entry
echo "$my_mac $my_ip $my_name @#$&*!" >> $mdns_result_file

#need query record right now when dut connect to rootap firstly
/usr/sbin/updateservice -uo 2>/dev/null
/usr/share/mdns/mdns_result_maintain 2>/dev/null

