Interface Management
Relevant source files
The following files were used as context for generating this wiki page:
Interface Management is the system within LuCI Mobile that monitors and configures OpenWrt network interfaces. It provides visibility into physical devices, logical interfaces, and wireless radios by communicating with the LuCI RPC service on the router.
The system tracks real-time metrics such as throughput, traffic totals, and connection states. It allows users to manage wired and wireless configurations, including IPv4/IPv6 addresses, SSIDs, and firewall zones.
Sources: README.md:16-20, fastlane/metadata/android/en-US/full_description.txt:10-13
Architecture and Data Models
The system categorizes network components into three distinct layers: Physical Devices, Logical Interfaces, and Wireless Radios. This separation allows the application to represent complex OpenWrt configurations like bridges and multi-protocol interfaces.
Physical Devices
Physical devices represent hardware or virtualized networking entities. The application retrieves metrics including transmission (TX) and reception (RX) statistics, MTU settings, and carrier status.
The diagram shows the relationship between standard network devices and bridge interfaces that group multiple devices.
Sources: assets/mock/network_devices.json:1-40
Logical Interfaces
Logical interfaces represent the UCI (Unified Configuration Interface) configuration for networking. Each interface maps to a physical device and defines the protocol (e.g., DHCP, Static) and addressing.
| Field | Type | Description |
|---|---|---|
| interface | String | The logical name (e.g., wan, lan, guest) |
| up | Boolean | Current operational state |
| proto | String | Network protocol used (dhcp, static, pppoe) |
| device | String | Underlying physical device name |
| ipv4-address | Array | List of assigned IPv4 addresses and masks |
| dns-server | Array | Upstream DNS servers assigned to the interface |
Sources: assets/mock/interface_dump.json:3-110
Wireless Interface Management
Wireless management handles radio hardware and the specific wireless networks (VAPs) running on them. The application reads hardware modes (e.g., 802.11ac), signal quality, and noise levels.
Radio and SSID Configuration
The system allows modification of wireless parameters including SSID, security encryption, and channel selection.
The flowchart describes how one physical radio supports multiple wireless interfaces with distinct configurations.
Sources: assets/mock/wireless_devices.json:1-40, fastlane/metadata/android/en-US/full_description.txt:14-14
Security and Zone Mapping
Logical interfaces are associated with firewall zones to control traffic flow. The system maps interfaces like lan or wan to specific security policies (ACCEPT, REJECT, DROP) and handles Masquerading (NAT) for outbound traffic.
| Zone Name | Interfaces | Input Policy | Forward Policy | Masquerading |
|---|---|---|---|---|
| lan | lan | ACCEPT | ACCEPT | 0 |
| wan | wan, wan6, wanb | REJECT | REJECT | 1 |
Sources: assets/mock/uci_firewall.json:13-36
Data Flow and Protocol
LuCI Mobile interacts with the router via the luci-rpc module. The application performs a specific sequence to retrieve interface data:
- Device Discovery: Calls
getNetworkDevicesto list physical hardware and current byte counters. - Interface Dump: Calls the interface dump method to obtain logical configuration and IP status.
- Wireless Scan: Queries
iwinfofor radio-specific data and associations.
The sequence diagram illustrates the multi-step polling required to build a complete view of the network status.
Sources: README.md:92-97, assets/mock/interface_dump.json
Configuration Safety
When users modify interface settings, the application utilizes the OpenWrt apply-with-rollback protocol. If the application cannot re-establish a connection with the router within a defined timeout after a change, the router automatically restores the previous working configuration. This prevents users from being permanently locked out due to incorrect IP or firewall settings.
Sources: README.md:38-42, fastlane/metadata/android/en-US/full_description.txt:23-23
Summary
Interface Management in LuCI Mobile provides a comprehensive abstraction of OpenWrt's networking stack. By aggregating data from network.interface, luci-rpc, and iwinfo, it enables real-time monitoring of traffic and signal quality while offering a safe mechanism for remote configuration changes.