net: add IWD backend with passphrase agent support#2735
Conversation
wirelessEnabled is wrong when the adapter is powered offnext.wirelessEnabled = !m_stations.empty(); This returns true as long as any station object exists, regardless of whether the device is actually powered on. A station object persists even when Device.Powered is false. This should check the Powered property on the device interface: Without this, setWirelessEnabled(false) will toggle the device off, but wirelessEnabled will still report true on the next rebuildState(). submitPasswordPrompt has incorrect dispatch when both agents existThe diff in network_tab.cpp adds: But this branch is only reached when m_pendingAccessPoint has no value AND m_secrets is null. In practice, if iwd is active, m_secrets should be null (NetworkSecretAgent is only created when supportsSecretAgent() returns true, which IwdService doesn't). So the logic happens to work — but it's fragile. If someone adds supportsSecretAgent() to IwdService later, the m_secrets branch would swallow iwd agent requests. A clearer approach: check which agent actually has a pending request: cancelPasswordPrompt has the same fragilitySame else if chain — m_iwdAgent->cancelSecret() is only reached if m_secrets is null. Synchronous GetOrderedNetworks in rebuildState()rebuildState() is called on every PropertiesChanged signal from every station. Each call does a synchronous GetOrderedNetworks() D-Bus method call for each station. On systems with many visible networks or multiple adapters, this could cause noticeable latency on the main loop. The other backends (NM, Synchronous Connect call in activateAccessPointNetwork.Connect() in iwd can block for several seconds (especially when the agent prompt is involved). This is a synchronous call on the main thread. The other backends may have the same issue, but it's worth noting — this will freeze the UI during connection attempts. rebuildState() clears m_knownNetworks on every callThis rebuilds known networks from network objects only. But network objects for out-of-range saved networks won't be present, so hasSavedConnection() will return false for any saved network that isn't currently visible. forgetSsid() won't work for those either. To properly enumerate saved networks, you'd need to query net.connman.iwd.KnownNetwork objects separately. Logging SSID in onRequestPassphraseWe try to avoid login any sensible/private data in the log. Missing InterfacesRemoved cleanup for networks used by known networksWhen InterfacesRemoved fires, both m_stations and m_networks are cleaned, but m_knownNetworks entries referencing removed network paths are left dangling until the next rebuildState(). This is benign since rebuildState() clears + rebuilds, but the ordering in the signal handler (erase then rebuildState) means it's fine. Minor Style Notes
|
Pull Request
If this PR is not ready for review yet, please mark it as Draft until it's good to be reviewed.
Motivation
Provide a clear and concise explanation of what this PR does and why it is needed.
Type of Change
Mark the relevant option with an "x".
Related Issue
Testing
Describe how you tested your changes and mark the relevant items.
Screenshots / Videos
If applicable, include screenshots or videos to help illustrate your changes.
Checklist
Additional Notes
Add any additional context or follow-up notes for reviewers.