Client Management & Traffic History
Relevant source files
The following files were used as context for generating this wiki page:
Client Management and Traffic History provides a centralized system for monitoring and controlling devices connected to an OpenWrt router. It aggregates data from DHCP leases, wireless association lists, and host hints to provide real-time oversight of network participants.
The system allows users to search for clients by hostname, IP address, MAC address, or vendor. It supports administrative actions such as reserving DHCP addresses, blocking devices via firewall rules, and waking sleeping devices over the network. Where the router supports it, the application tracks per-client traffic history to monitor bandwidth consumption. Sources: README.md:16-30
Client Discovery and Identification
The application identifies clients by cross-referencing multiple data sources from the LuCI RPC interface. This ensures that even devices without active DHCP leases (e.g., static IP devices) are visible if they are wirelessly associated or present in the kernel's neighbor table.
Data Sources for Client Identification
| Source File | Purpose | Data Fields Extracted |
|---|---|---|
dhcp_leases.json | Active IPv4 assignments | MAC, IP, Hostname, Expiry |
host_hints.json | Known device mappings | MAC address, Name, IPv4/IPv6 address arrays |
assoclist_wlanX.json | Wireless radio associations | MAC, Signal, Noise, Tx/Rx rates, Connected time |
uci_dhcp.json | Static lease configurations | MAC, IP, Name assigned in UCI |
Sources: assets/mock/dhcp_leases.json, assets/mock/host_hints.json, assets/mock/assoclist_wlan0.json, assets/mock/uci_dhcp.json:44-59
Identification Flow
The following diagram illustrates how a client object is constructed from fragmented router data:
The application joins these datasets using the MAC address as the unique identifier. Sources: assets/mock/host_hints.json, assets/mock/dhcp_leases.json
Wireless Client Metrics
Wireless clients provide additional telemetry regarding link quality and hardware capabilities. The application retrieves these metrics per radio interface (e.g., wlan0 for 2.4GHz, wlan1 for 5GHz).
Link Quality and Performance
The application tracks the following metrics for associated stations:
- Signal/Noise: Measured in dBm to calculate link margin. Sources: assets/mock/assoclist_wlan0.json:5-6
- Transmission Rates: Includes MCS (Modulation and Coding Scheme), MHz (bandwidth), and NSS (Spatial Streams). Sources: assets/mock/assoclist_wlan0.json:13-21
- Connectivity State: "Authorized" and "Authenticated" boolean flags. Sources: assets/mock/assoclist_wlan0.json:34-35
Traffic History and Totals
Traffic monitoring tracks the data volume consumed by each device. The application reports both cumulative totals and instantaneous rates where available.
Bandwidth Monitoring Fields
The system parses raw byte counts from the association lists to determine consumption:
rx_bytes: Data received by the router from the client.tx_bytes: Data transmitted by the router to the client.rx_packets/tx_packets: Total packet count for the current session.
Sources: assets/mock/assoclist_wlan0.json:9-12
Administrative Controls
The application enables direct management of clients through UCI (Unified Configuration Interface) modifications.
DHCP Reservation
Users can create static leases to ensure a device always receives the same IP address. This is stored in the dhcp configuration under type: host.
Sources: assets/mock/uci_dhcp.json:44-59
Firewall Blocking
The application implements client blocking by creating specific firewall rules. These rules target the src_mac of the client and set the target to REJECT.
Sources: assets/mock/uci_firewall.json:48-57
"luci_mobile_block_ccddee98765a": {
".type": "rule",
"name": "Block Baby-Monitor (LuCI Mobile)",
"src": "lan",
"src_mac": "CC:DD:EE:98:76:54",
"dest": "*",
"target": "REJECT",
"enabled": "1"
}
Sources: assets/mock/uci_firewall.json:48-57
Summary
The Client Management & Traffic History module provides a comprehensive view of network activity by merging DHCP data, wireless signal telemetry, and UCI configurations. By using the MAC address as a primary key, it enables precise identification and control, allowing for bandwidth monitoring and security enforcement via firewall integration.