Skip to content

Use IWD autoconnect

This branch changes NMDeviceIwd to disable the autoconnect logic in NMPolicy by:

  1. basically, always returning FALSE from .get_autoconnect_allowed()
  2. instead of treating an unsolicited IWD state change to connecting, connected, etc. as error (and commanding IWD to disconnect immediately), finding or generating a compatible NMSettingsConnection and moving it to a state corresponding to the IWD state.

The logic is in the 3rd patch from the last (9cd87ecb).

It seems like the .update_connection / nm_device_queue_recheck_assume() API was designed for this use case but I decided to not use it in this version of the patch for various reasons:

  1. the implementation in NMManager is quite complicated, a consequence of the API design. Since NMIwdManager already keeps pointers to NMSettingsConnections corresponing to IWD's network profiles (Known Networks) it seems like there'd be unneeded overhead.
  2. the IWD backend doesn't do IP_CONFIG and the later activation steps, so when the IP_CONFIG stage starts the connection should stop being assumed or external but there's no API to do this. assumed activations are converted to managed only after full activation. external activations are converted to managed when the NMSettingsConnection loses the EXTERNAL flag, which may be too soon because we may be connecting to a profile that already exists in NM.
  3. the ACTIVATING and DEACTIVATING device states are not taken into account in find_best_device_state which is a slight downside for the user experience.

I'm happy to talk about workarounds or adding a new API that could be used for this, if preferred over faking it all inside NMDeviceIwd. Most of the logic, like the PREPARE, CONFIG and NEED_AUTH stages will be the same whichever API is used so it should be easy to convert this code to a different API.

Edited by Andrew Zaborowski

Merge request reports