Development issues regarding the cerowrt test router project
 help / color / mirror / Atom feed
From: Dave Taht <dave.taht@gmail.com>
To: cerowrt-devel@lists.bufferbloat.net
Subject: Re: [Cerowrt-devel] figuring out who's actually on an ap
Date: Sat, 26 Jan 2013 11:00:10 -0800	[thread overview]
Message-ID: <CAA93jw6BbDsD5oo=gsy6bWnzJAZYUmZU65nKmtB6AcGbqFE9bQ@mail.gmail.com> (raw)
In-Reply-To: <CAA93jw4VaE5Y=imPKCbPrxEFr7cuv+c8+h+N5P0uW7w-PfgM+A@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3127 bytes --]

On Sat, Jan 26, 2013 at 10:22 AM, Dave Taht <dave.taht@gmail.com> 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 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 we 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...
>
> 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=`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         = no
        socket_type     = stream
        wait            = no
        user            = nobody
        only_from   = my_ipv4_ip/32 my_ipv6_ip/64
        port            = 79
        type            = UNLISTED
        server          = /etc/rup
        flags           = IPv6
        log_on_success  += HOST USERID
        log_on_failure  += HOST USERID
        instances       = 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 = 2/2/0%, min/avg/max = 6.64/187/368
172.20.3.99  : xmt/rcv/%loss = 2/0/100%
172.20.3.180 : xmt/rcv/%loss = 2/0/100%
172.20.3.141 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 75.1/77.9/80.7
172.20.3.212 : xmt/rcv/%loss = 2/0/100%
172.20.3.128 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 23.9/122/222
172.20.3.229 : xmt/rcv/%loss = 2/0/100%
172.20.3.172 : xmt/rcv/%loss = 2/0/100%
172.20.3.34  : xmt/rcv/%loss = 2/0/100%
172.20.3.102 : xmt/rcv/%loss = 2/2/0%, min/avg/max = 0.07/0.08/0.09
172.20.3.146 : xmt/rcv/%loss = 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=`grep PMCS "$i/rc_stats"`
        STATION=`echo $i | cut -f9 -d/`
        [ -z "$STATION" ] && exit
        B=`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äht
>
> Fixing bufferbloat with cerowrt:
> http://www.teklibre.com/cerowrt/subscribe.html




-- 
Dave Täht

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

[-- Attachment #2: Type: text/html, Size: 4013 bytes --]

      reply	other threads:[~2013-01-26 19:00 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-01-26 18:22 Dave Taht
2013-01-26 19:00 ` Dave Taht [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://lists.bufferbloat.net/postorius/lists/cerowrt-devel.lists.bufferbloat.net/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAA93jw6BbDsD5oo=gsy6bWnzJAZYUmZU65nKmtB6AcGbqFE9bQ@mail.gmail.com' \
    --to=dave.taht@gmail.com \
    --cc=cerowrt-devel@lists.bufferbloat.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox