openwisp / openwisp/netengine

[feature] OpenWRT: extract associated WiFi stations

Open
#66 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
42
Forks
18
Avg merge
12h 54m
Merged PRs (30d)
1

Description

This is one of the pieces of information in which openwisp users are mostly interested since it's widely used in public WiFi networks.

We can get this information with additional scripts and a custom MIB.
We could use iw or ubus (as we do in netjson-monitoring).
If we get a good result we could even send a patch to include these scripts in net-snmpd on OpenWRT by default.

Example exec net-snmpd script on on OpenWRT:

in /tmp/test:

#!/bin/sh
iwinfo

in /etc/config/snmpd:

config exec 'iwinfo'       
  option name 'iwinfo'
  option prog '/tmp/test' 
  option miboid '1.2.3.4'  

Output:

snmpwalk -v2c -c public <ip> 1.2.3.4
iso.2.3.4.1.1 = INTEGER: 1
iso.2.3.4.2.1 = STRING: "yo"
iso.2.3.4.3.1 = STRING: "/tmp/test"
iso.2.3.4.100.1 = INTEGER: 0
iso.2.3.4.101.1 = STRING: "wlan1     ESSID: \"fvgwifi-demo\""
iso.2.3.4.101.2 = STRING: "          Access Point: 46:D1:FA:4B:38:42"
iso.2.3.4.101.3 = STRING: "          Mode: Master  Channel: 1 (2.412 GHz)"
iso.2.3.4.101.4 = STRING: "          Tx-Power: 20 dBm  Link Quality: unknown/70"
iso.2.3.4.101.5 = STRING: "          Signal: unknown  Noise: -92 dBm"
iso.2.3.4.101.6 = STRING: "          Bit Rate: unknown"
iso.2.3.4.101.7 = STRING: "          Encryption: none"
iso.2.3.4.101.8 = STRING: "          Type: nl80211  HW Mode(s): 802.11bgn"
iso.2.3.4.101.9 = STRING: "          Hardware: unknown [Generic MAC80211]"
iso.2.3.4.101.10 = STRING: "          TX power offset: unknown"
iso.2.3.4.101.11 = STRING: "          Frequency offset: unknown"
iso.2.3.4.101.12 = STRING: "          Supports VAPs: yes  PHY name: phy1"
iso.2.3.4.101.13 = ""
iso.2.3.4.101.14 = STRING: "wlo1      ESSID: \"broadgee-backup\""
iso.2.3.4.101.15 = STRING: "          Access Point: 44:D1:FA:4B:38:42"
iso.2.3.4.101.16 = STRING: "          Mode: Master  Channel: 1 (2.412 GHz)"
iso.2.3.4.101.17 = STRING: "          Tx-Power: 20 dBm  Link Quality: 62/70"
iso.2.3.4.101.18 = STRING: "          Signal: -48 dBm  Noise: -92 dBm"
iso.2.3.4.101.19 = STRING: "          Bit Rate: 36.1 MBit/s"
iso.2.3.4.101.20 = STRING: "          Encryption: WPA2 PSK (CCMP)"
iso.2.3.4.101.21 = STRING: "          Type: nl80211  HW Mode(s): 802.11bgn"
iso.2.3.4.101.22 = STRING: "          Hardware: unknown [Generic MAC80211]"
iso.2.3.4.101.23 = STRING: "          TX power offset: unknown"
iso.2.3.4.101.24 = STRING: "          Frequency offset: unknown"
iso.2.3.4.101.25 = STRING: "          Supports VAPs: yes  PHY name: phy1"
iso.2.3.4.101.26 = ""
iso.2.3.4.102.1 = INTEGER: 0
iso.2.3.4.103.1 = ""

Of course the example above is naive but just explains how to get additional info on OpenWRT via SNMPd.

The important info we currently get from netjson-monitoring is:

"channel": 1,
"country": "IT",
"frequency": 2412,
"mode": "access_point",
"noise": -93,
"signal": -54,
"ssid": "SSID name",
"tx_power": 20,
"clients": [
    {
        "aid": 1,
        "assoc": true,
        "auth": true,
        "authorized": true,
        "ht": true,
        "mac": "<MACADDR>",
        "mfp": false,
        "preauth": false,
        "vht": false,
        "wds": false,
        "wmm": true,
        "wps": false
    }
]

I think we can get this info with a mixture of commands like uci get, iwinfo, iw <interface> station dumpor via ubus and jsonfilter.

We can work on this idea once we complete the first release.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Review the proposed OpenWRT entry points in /tmp/test and /etc/config/snmpd, along with iw, iwinfo, ubus, jsonfilter, and the netjson-monitoring client data. Define an approach for extracting associated WiFi stations and the listed client fields; done means this information can be obtained through the project’s SNMP-based device abstraction.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, shell
Domain
networking, operating-systems
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.