Something like this, but it would need to be adapted for non-Broadcom chipsets.And if you might have clients that don't use DHCP, the other method people used in the past was to create a cron job that polls the list of associated clients, reacting whenever a new one appears on the list. Might be a delay involved (if for instance you poll every minute), but it would be more accurate.
#!/bin/sh
/jffs/scripts/wireless_monitor.sh &
#!/bin/sh
oldlist=/tmp/assoclist.old
newlist=/tmp/assoclist.new
touch $oldlist # Create an empty file the first time through
while sleep 15
do
for iface in $(nvram get wl_ifnames)
do
wl -i $iface assoclist | awk '{print $2}' >> $newlist
done
for macaddr in $(grep -vxFf $oldlist $newlist)
do
arpinfo="$(arp -a | grep -iF $macaddr | awk '{print $1 " " $2}')"
logger -t wireless $macaddr $arpinfo "has connected."
done
for macaddr in $(grep -vxFf $newlist $oldlist)
do
arpinfo="$(arp -a | grep -iF $macaddr | awk '{print $1 " " $2}')"
logger -t wireless $macaddr $arpinfo "has disconnected."
done
mv $newlist $oldlist
done
wl_atheros assoclist | grep $MAC_ADDRESS
And if you might have clients that don't use DHCP, the other method people used in the past was to create a cron job that polls the list of associated clients, reacting whenever a new one appears on the list. Might be a delay involved (if for instance you poll every minute), but it would be more accurate.
You could also potentially look at the ARP cache content, but that won't allow you to distinguish wired from wireless clients.
What's not worth doing? The dnsmasq script?I have to agree with Eric here...
Not worth doing...
We use essential cookies to make this site work, and optional cookies to enhance your experience.