Use IWD autoconnect
This branch changes NMDeviceIwd to disable the autoconnect logic in NMPolicy by:
- basically, always returning FALSE from
.get_autoconnect_allowed()
- 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:
- 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.
- 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
orexternal
but there's no API to do this.assumed
activations are converted tomanaged
only after full activation.external
activations are converted tomanaged
when the NMSettingsConnection loses theEXTERNAL
flag, which may be too soon because we may be connecting to a profile that already exists in NM. - the
ACTIVATING
andDEACTIVATING
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.