OpenWrt logging: how to find out "wifi deauthentication"

3

1

If someone starts to use the wifi, i can see that with logread:

Jan 23 21:04:47 router daemon.info hostapd: wlan0: STA XX:XX:XX:XX:XX:XX IEEE 802.11: authenticated

But how can i see, that he/she's disconnecting? Theres no "bla-bla deauthenticated bla" line in logread, or even a thing that points to that someone get's disconnected..

I tried to google:
http://wiki.openwrt.org/doc/uci/system
But it doesn't writes about loglevel.

Can anyone help me find out, how to find out that someone disconnects it's wifi from the router? The logread doesn't even writes a line when someone disconnects.

Please help!! It's important!
Thank you!:\

LanceBaynes

Posted 2011-01-23T20:17:36.660

Reputation: 3 510

Answers

4

You can poll the list of associated clients from one of the following commands:

  • iw dev wlan0 station dump --> for nl80211/mac80211 compatible drivers

  • wlc assoclist --> for proprietary broadcom-wl driver

  • iwinfo wlan0 assoclist --> for libiwinfo abstraction available in OpenWrt trunk

Judging by hostapd in your logs the first one should work. Example output:

   root@OpenWrt ~ # iw dev wlan0 station dump
   Station 00:13:02:xx:xx:xx (on wlan0)
      inactive time:    0 ms
      rx bytes: 21835
      rx packets:   152
      tx bytes: 19772
      tx packets:   100
      tx retries:   6
      tx failed:    0
      signal:   -43 dBm
      signal avg:   -44 dBm
      tx bitrate:   36.0 MBit/s

Also hostapd reports disconnections (eg if run from commandline - surely there's a way to get this into logs):

root@OpenWrt ~ # hostapd -P /var/run/wifi-phy0.pid /var/run/hostapd-phy0.conf
Using interface wlan0 with hwaddr 94:0c:6d:xx:xx:xx and ssid 'marvin'
wlan0: STA 00:13:02:xx:xx:xx IEEE 802.11: authenticated
wlan0: STA 00:13:02:xx:xx:xx IEEE 802.11: associated (aid 1)
AP-STA-CONNECTED 00:13:02:xx:xx:xx
wlan0: STA 00:13:02:xx:xx:xx WPA: pairwise key handshake completed (RSN)
(...)
AP-STA-DISCONNECTED 00:13:02:xx:xx:xx

Alternatively you can connect to hostapd via its control socket using wpa-cli:

root@OpenWrt ~ # wpa_cli -p /var/run/hostapd-phy0       
wpa_cli v0.8.x
Copyright (c) 2004-2010, Jouni Malinen <j@w1.fi> and contributors

This program is free software. You can distribute it and/or modify it
under the terms of the GNU General Public License version 2.

Alternatively, this software may be distributed under the terms of the
BSD license. See README and COPYING for more details.


Selected interface 'wlan0'

Interactive mode
>
(...here client connects...)
<3>AP-STA-CONNECTED 00:13:02:xx:xx:xx
(...and here disconnects...)
<3>AP-STA-DISCONNECTED 00:13:02:xx:xx:xx

koniu

Posted 2011-01-23T20:17:36.660

Reputation: 566