Skip to content

[th/dev-available-con-for-user-request] device: fix available-connections for a device for user-request

Thomas Haller requested to merge th/dev-available-con-for-user-request into main

There are two callers of available_connections_add(). One from cp_connection_added_or_updated() (which is when a connection gets added/modified) and one from nm_device_recheck_available_connections().

They both call first nm_device_check_connection_available() to see whether the profile is available on the device. They certainly need to pass the same check flags, otherwise a profile might be available in some cases, and not in others.

I didn't actually test this, but I think this could result in a profile wrongly not being listed as an available-connection. Moreover, that might mean, that nmcli connection up $PROFILE might work to find the device/profile, but nmcli device up $DEVICE couldn't find the suitable profile (because the latter calls nm_device_get_best_connection(), which iterates the available-connections). I didn't test this, because regardless of that, it seems obvious that the conditions for when we call available_connections_add() must be the same from both places. So the only question is what is the right condition, and it would seem that _NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST is the right flag.

Fixes: 02dbe670 ('device: for available connections check whether they are available for user-request')

Merge request reports