Linux Wi-Fi Telemetry library and daemon.
Перейти к файлу
Andrew Beltrano 6dbfebfe59 Add initial changelog. 2021-06-11 11:49:05 -06:00
.github Add issue templates (#6) 2021-06-11 10:19:24 -07:00
cmake Add initial source code. 2021-06-07 17:57:46 -06:00
external Add initial source code. 2021-06-07 17:57:46 -06:00
include/wifi-telemetry Add initial source code. 2021-06-07 17:57:46 -06:00
scripts Update release script to use git archive (#5) 2021-06-11 09:00:35 -07:00
src Add initial source code. 2021-06-07 17:57:46 -06:00
.clang-format Add initial source code. 2021-06-07 17:57:46 -06:00
.gitattributes Update release script to use git archive (#5) 2021-06-11 09:00:35 -07:00
.gitignore Add initial source code. 2021-06-07 17:57:46 -06:00
CHANGELOG.md Add initial changelog. 2021-06-11 11:49:05 -06:00
CMakeLists.txt Add initial source code. 2021-06-07 17:57:46 -06:00
CODE_OF_CONDUCT.md Initial CODE_OF_CONDUCT.md commit 2021-05-17 09:25:00 -07:00
LICENSE Initial LICENSE commit 2021-05-17 09:25:01 -07:00
README.md Update README with usage information. (#2) 2021-06-11 10:23:05 -07:00
SECURITY.md Initial SECURITY.md commit 2021-05-17 09:25:02 -07:00
SUPPORT.md Add initial source code. 2021-06-07 17:57:46 -06:00

README.md

Wi-Fi Telemetry

This project provides a Wi-Fi telemetry library and daemon. It enables realtime collection and reporting of Wi-Fi related events. It can be used in conjunction with the the wifi-ztp project to analyze and collect Wi-Fi zero touch provisioning telemetry as well.

Building

Ubuntu (focal)

sudo apt install build-essential cmake git liblttng-ust-dev libpci-dev libssl-dev libsystemd-dev pkg-config

Checkout and build:

git clone git@github.com:microsoft/wifi-telemetry.git
cd wifi-telemetry
mkdir build && cd $_
cmake ..
make -j $(nproc)

Usage

The central concept is that of a telemetry monitor, represented as WifiTelemetryMonitor. A monitor passively tracks one or more Wi-Fi telemetry sources, represented as WifiTelemetrySource, each of which is optionally bound to a device interface (eg. wlan0) and Wi-Fi operational mode, either station or access-point. Event information is aggregated and translated to lttng events. All telemetry is local and never leaves the device.

The daemon accepts a series of flag tuples for each telemetry source:

Flag Presence Description Supported Values Examples
-s Required telemetry source identifier wpa, ztp -s wpa
-i Optional Wi-Fi device interface name Any valid Wi-Fi device name -i wlan0, -i wl01s9
-o Optional Wi-Fi operational mode sta, station, ap, access-point -o station, -o ap

Telemetry Sources

Wi-Fi Protected Access (WPA) Supplicant (wpa)

This source passively monitors basic Wi-Fi connectivity and Device Provisioning Protocol (DPP aka Wi-Fi EasyConnect) events originating from a wpa_supplicant control socket.

Zero Touch Provisioning Daemon (ztp)

This source passively monitors zero touch provisioning daemon (ztpd) events originating from the ztpd d-bus inteface. Some events are not bound to a specific interface.

lttng Providers and Tracepoints

Provider Tracepoint Source Description
wifi device_info wpa Interface, model, driver, subsystem and vendor info.
wifi-station connection-attempt wpa Result, bssid, signal, frequency, security, status.
wifi-station connection-drop wpa Reason, bssid, locally generated.
wifi-dpp dpp_exchange_enrollee wpa State, role, duration, failure details, frequencies.
wifi-dpp dpp_exchange_configurator wpa State, role, duration, failure details, frequency.
wifi-dpp dpp_device_roles_changed ztp Device role(s) changed.

Examples

Monitor basic Wi-Fi client connectivity on wlan0

$ wifi-telemetryd -s wpa -i wlan0 -o sta
activated telemetry source 'wpa'
telemetry monitor started with 1 of 1 telemetry sources

Monitor basic wifi-client connectivity and ztp events on wlan1

$ wifi-telemetryd -s wpa -i wlan1 -o station -s ztp
activated telemetry source 'wpa'
activated telemetry source 'ztpd'
telemetry monitor started with 2 of 2 telemetry sources

Monitor Wi-Fi client connectivity with systemd instantiated service unit on arbitrary interface (%i)

wifi-telemetryd-station@service.in:

[Unit]
Description=Wi-Fi Telemetry Daemon (WPA Station)
Requires=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device

[Service]
Type=simple
Restart=on-failure
ExecStart=/usr/sbin/wifi-telemetryd -s wpa -o station -i %i

View all Wi-Fi telemetry in real-time with lttng

$ lttng create --live
Live session auto-20210610-220234 created.
Traces will be output to tcp4://127.0.0.1:5342/ [data: 5343]
Live timer interval set to 1000000 us
$ lttng enable-event -u "wifi:* wifi_station:* wifi_dpp:*"
UST event wifi:* wifi_station:* wifi_dpp:* created in channel channel0
$ lttng start
Tracing started for session auto-20210610-220234
$ lttng view
Trace directory: net://localhost/host/apd-d8c0a65935ed/auto-20210610-220234$ lttng create --live
<Wi-Fi tracepoint events...>

Contributing

This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.

When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.

This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.

Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow Microsoft's Trademark & Brand Guidelines. Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.