From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ie0-x235.google.com (mail-ie0-x235.google.com [IPv6:2607:f8b0:4001:c03::235]) (using TLSv1 with cipher RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (verified OK)) by huchra.bufferbloat.net (Postfix) with ESMTPS id 229B521F19C for ; Sat, 26 Jan 2013 11:00:11 -0800 (PST) Received: by mail-ie0-f181.google.com with SMTP id 17so390712iea.12 for ; Sat, 26 Jan 2013 11:00:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:content-type; bh=25ymx+F/Eeq6gocwRr6P4rGduHFlJMoM7yBmCCUY92k=; b=xTjX2nWwUDEEDriqg7li3E/AlDax+dyLwMO9CnztDcrNcCBd9qO71n4cI69ARpOeEr p2OJXdHqel4TFqKDI7oSPliCB7h/pcONIPWHBPj9Fpeqf8XrP6+F6+qjRzvHDtt6lSO1 E69W+t7EWGQRsNbkBbHCfSXlwZXPM413blVhesevh3HXfH+78qKO5t3x1iRhugmGvMyQ /VzyVueEx1WOc/f5IViUyS5WZYKNLz7vXYpGtgGxqpWTv9tjJBwKHQSd+a2le2ey2QNi sIfoS2jQSgOIS77TmR2h9upKg5PSJECQM+RIaXrq8+rnI7wgONcfyW5h+osTgrrPBXXF HUpA== MIME-Version: 1.0 X-Received: by 10.50.56.139 with SMTP id a11mr1499915igq.86.1359226810423; Sat, 26 Jan 2013 11:00:10 -0800 (PST) Received: by 10.64.135.39 with HTTP; Sat, 26 Jan 2013 11:00:10 -0800 (PST) In-Reply-To: References: Date: Sat, 26 Jan 2013 11:00:10 -0800 Message-ID: From: Dave Taht To: cerowrt-devel@lists.bufferbloat.net Content-Type: multipart/alternative; boundary=f46d0401f449345b4504d435a7b9 Subject: Re: [Cerowrt-devel] figuring out who's actually on an ap X-BeenThere: cerowrt-devel@lists.bufferbloat.net X-Mailman-Version: 2.1.13 Precedence: list List-Id: Development issues regarding the cerowrt test router project List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 26 Jan 2013 19:00:11 -0000 --f46d0401f449345b4504d435a7b9 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable On Sat, Jan 26, 2013 at 10:22 AM, Dave Taht wrote: > Once upon a time it was possible to write quick and dirty tools in shell. > You used to just be able to open a port, write a tiny little daemon, and > go. And we used to have handy tools like rwho and finger to figure out wh= o > was online, ruptime to check uptime, etc, etc. > > That's too insecure nowadays... > so we have 3 different levels of snmp which you can use (if you can secur= e > it), and > run a shell command from that, remotely, then parse... or use ssh, and > parse. > > And then we have dhcp, which hands out leases, but is not tied to how wif= i > goes up > and down. > > This morning I had a need to figure who was actually on a couple cerowrt > APs, > and a few statistics as to their connected rate... > > I haven't got so as figuring out how to do all that via snmpd yet, but as > this uses > an obscure feature of the mac802.11 stack, I thought I'd document this > much. > > If there is a better way, a mib, something, let me know.... > > #!/bin/sh > # rup: quickly see whos really on the wifi > > A=3D`ls /sys/kernel/debug/ieee80211/phy*/netdev:*/stations | \ > cut -f8 -d/ | tr '\n' '|'` > # cut off last | > egrep ${A%?} /tmp/dhcp.leases | awk '{print $3 " " $4 }' > > > Or, you can just stick it into /etc/xinetd.d/rup service rup { disable =3D no socket_type =3D stream wait =3D no user =3D nobody only_from =3D my_ipv4_ip/32 my_ipv6_ip/64 port =3D 79 type =3D UNLISTED server =3D /etc/rup flags =3D IPv6 log_on_success +=3D HOST USERID log_on_failure +=3D HOST USERID instances =3D 4 } nc 172.20.2.2 79 | awk '{print $1}' | fping -c 2 -q and be done with it. 172.20.3.210 : xmt/rcv/%loss =3D 2/2/0%, min/avg/max =3D 6.64/187/368 172.20.3.99 : xmt/rcv/%loss =3D 2/0/100% 172.20.3.180 : xmt/rcv/%loss =3D 2/0/100% 172.20.3.141 : xmt/rcv/%loss =3D 2/2/0%, min/avg/max =3D 75.1/77.9/80.7 172.20.3.212 : xmt/rcv/%loss =3D 2/0/100% 172.20.3.128 : xmt/rcv/%loss =3D 2/2/0%, min/avg/max =3D 23.9/122/222 172.20.3.229 : xmt/rcv/%loss =3D 2/0/100% 172.20.3.172 : xmt/rcv/%loss =3D 2/0/100% 172.20.3.34 : xmt/rcv/%loss =3D 2/0/100% 172.20.3.102 : xmt/rcv/%loss =3D 2/2/0%, min/avg/max =3D 0.07/0.08/0.09 172.20.3.146 : xmt/rcv/%loss =3D 2/0/100% and to gather remote rate stats: #!/bin/sh # Gather connected speeds and minstrel error rates from remote wifi for i in /sys/kernel/debug/ieee80211/phy*/netdev:*/stations/* do RATE=3D`grep PMCS "$i/rc_stats"` STATION=3D`echo $i | cut -f9 -d/` [ -z "$STATION" ] && exit B=3D`grep ${STATION} /tmp/dhcp.leases 2> /dev/null | awk '{print $3= }'` echo "$B $RATE" done # and I suppose this will blow up in ipv6... > > -- > Dave T=E4ht > > Fixing bufferbloat with cerowrt: > http://www.teklibre.com/cerowrt/subscribe.html --=20 Dave T=E4ht Fixing bufferbloat with cerowrt: http://www.teklibre.com/cerowrt/subscribe.html --f46d0401f449345b4504d435a7b9 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable

On Sat, Jan 26, 2013 at 10:22 AM, Dave T= aht <dave.taht@gmail.com> wrote:
Once upon a time it was possible to write quick and dirty tools in shell. Y= ou used to just be able to open a port, write a tiny little daemon, and go.= And we used to have handy tools like rwho and finger to figure out who was= online, ruptime to check uptime, etc, etc.

That's too insecure nowadays...
so we have 3 different levels of= snmp which you can use (if you can secure it), and
run a shell command = from that, remotely, then parse... or use ssh, and parse.

And then w= e have dhcp, which hands out leases, but is not tied to how wifi goes up and down.

This morning I had a need to figure who was actually on a = couple cerowrt APs,
and a few statistics as to their connected rate... <= br>
I haven't got so as figuring out how to do all that via snmpd ye= t, but as this uses
an obscure feature of the mac802.11 stack, I thought I'd document this = much.

If there is a better way, a mib, something, let me know....
#!/bin/sh
# rup: quickly see whos really on the wifi<= br>
A=3D`ls /sys/kernel/debug/ieee80211/phy*/netdev:*/stations | \
=A0= =A0=A0 cut -f8 -d/ | tr '\n' '|'`
# cut off last |
eg= rep ${A%?} /tmp/dhcp.leases | awk '{print $3 " " $4 }'



Or, you can just stick it into = /etc/xinetd.d/rup

service rup
{
=A0=A0=A0=A0=A0=A0=A0 disable= =A0=A0=A0=A0=A0=A0=A0=A0 =3D no
=A0=A0=A0=A0=A0=A0=A0 socket_type=A0=A0= =A0=A0 =3D stream
=A0=A0=A0=A0=A0=A0=A0 wait=A0=A0=A0=A0=A0=A0=A0=A0=A0= =A0=A0 =3D no
=A0=A0=A0=A0=A0=A0=A0 user=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D nobody
=A0=A0=A0=A0=A0=A0=A0 only_from=A0=A0 =3D my_ipv4_ip/32 my_ipv6_ip/64
= =A0=A0=A0=A0=A0=A0=A0 port=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D 79
=A0= =A0=A0=A0=A0=A0=A0 type=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D UNLISTED
= =A0=A0=A0=A0=A0=A0=A0 server=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D /etc/rup
=A0= =A0=A0=A0=A0=A0=A0 flags=A0=A0=A0=A0=A0=A0=A0=A0=A0=A0 =3D IPv6
=A0=A0= =A0=A0=A0=A0=A0 log_on_success=A0 +=3D HOST USERID
=A0=A0=A0=A0=A0=A0=A0 log_on_failure=A0 +=3D HOST USERID
=A0=A0=A0=A0=A0= =A0=A0 instances=A0=A0=A0=A0=A0=A0 =3D 4
}


nc 172.20.2.2 79 |= awk '{print $1}' | fping -c 2 -q

and be done with it.
172.20.3.210 : xmt/rcv/%loss =3D 2/2/0%, min/avg/max =3D 6.64/187/368
172.20.3.99=A0 : xmt/rcv/%loss =3D 2/0/100%
172.20.3.180 : xmt/rcv/%loss= =3D 2/0/100%
172.20.3.141 : xmt/rcv/%loss =3D 2/2/0%, min/avg/max =3D 7= 5.1/77.9/80.7
172.20.3.212 : xmt/rcv/%loss =3D 2/0/100%
172.20.3.128 = : xmt/rcv/%loss =3D 2/2/0%, min/avg/max =3D 23.9/122/222
172.20.3.229 : xmt/rcv/%loss =3D 2/0/100%
172.20.3.172 : xmt/rcv/%loss = =3D 2/0/100%
172.20.3.34=A0 : xmt/rcv/%loss =3D 2/0/100%
172.20.3.102= : xmt/rcv/%loss =3D 2/2/0%, min/avg/max =3D 0.07/0.08/0.09
172.20.3.146= : xmt/rcv/%loss =3D 2/0/100%

and to gather remote rate stats:

#!/bin/sh
# Gather connected= speeds and minstrel error rates from remote wifi

for i in /sys/kern= el/debug/ieee80211/phy*/netdev:*/stations/*
do
=A0=A0=A0=A0=A0=A0=A0 = RATE=3D`grep PMCS "$i/rc_stats"`
=A0=A0=A0=A0=A0=A0=A0 STATION=3D`echo $i | cut -f9 -d/`
=A0=A0=A0=A0=A0= =A0=A0 [ -z "$STATION" ] && exit
=A0=A0=A0=A0=A0=A0=A0= B=3D`grep ${STATION} /tmp/dhcp.leases 2> /dev/null | awk '{print $3= }'`
=A0=A0=A0=A0=A0=A0=A0 echo "$B $RATE"
done

# and I suppose this will blow up in ipv6...



--
Dave T=E4ht

Fixing bufferbloat with cerowrt: http:= //www.teklibre.com/cerowrt/subscribe.html=20



--
Dave T=E4= ht

Fixing bufferbloat with cerowrt: http://www.teklibre.com/cerowr= t/subscribe.html=20 --f46d0401f449345b4504d435a7b9--