NetworkManager/clients/cli
Thomas Haller 3bc6ae6152
cli: fix showing active state for nmcli con show with fields
With "connection.multi-connect", a profile can be activated multiple
times on a device with `nmcli connection show`. Also, a profile may be
in the process of deactivating on one device, while activating on
another one. So, in general it's possible that `nmcli connection show`
lists the same profile on multiple lines (reflecting their multiple
activation states).

If the user requests no fields that are part of the activation state,
then the active connections are ignored. For example with `nmcli
-f UUID,NAME connection show`. In that case, each profile is listed only
once.

On the other hand, with `nmcli -g UUID,NAME,DEVICE connection show` the
user again requested also to see the activation state, and a profile can
appear multiple times.

To handle that, we need to consider which fields were requested.

There was a bug where the "ACTIVE" field was not treated as part of the
activation state. That results in `nmcli -f UUID,NAME,ACTIVE connection
show` always returning "no". Fix that.

Fixes: a1b25a47b0 ('cli: rework printing of `nmcli connection` for multiple active connections')

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/issues/547

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/642
(cherry picked from commit 4eb3b5b9dd)
(cherry picked from commit bb802507e4)
(cherry picked from commit 8bd6d2a63e)
2020-12-08 15:20:16 +01:00
..
agent.c cli: remove redundant return value from NMCCommand funcs 2020-04-10 10:44:37 +02:00
common.c cli: remove redundant return value from NMCCommand funcs 2020-04-10 10:44:37 +02:00
common.h cli: mark argv argument for command line parsing as const 2020-04-10 10:27:27 +02:00
connections.c cli: fix showing active state for nmcli con show with fields 2020-12-08 15:20:16 +01:00
connections.h cli: mark argv argument for command line parsing as const 2020-04-10 10:27:27 +02:00
devices.c cli: fix reference count handling in hotspot error path 2020-08-04 23:48:16 +02:00
devices.h cli: cleanup NMCCommand and declarations of func implementations 2020-04-10 10:27:27 +02:00
general.c cli: remove redundant return value from NMCCommand funcs 2020-04-10 10:44:37 +02:00
meson.build license: Add license using SPDX identifiers to meson build files 2020-02-17 13:16:57 +01:00
nmcli-completion cli: make nmcli do its own command completion 2017-02-13 16:32:15 +01:00
nmcli.c cli: unref main loop after destroying NMClient instance 2020-05-12 23:02:48 +02:00
nmcli.h cli: remove redundant return value from NMCCommand funcs 2020-04-10 10:44:37 +02:00
polkit-agent.c cli/polkit: rename NM_POLKIT_LISTENER_SIGNAL_REQUEST signal to "request-sync" 2020-04-10 10:44:52 +02:00
polkit-agent.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
settings.c cli: hide nm_cli global variable from public headers 2020-04-04 19:28:41 +02:00
settings.h all: unify format of our Copyright source code comments 2019-10-02 17:03:52 +02:00
utils.c cli: let _print_fill() hide option if NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE is set 2020-04-20 08:54:55 +02:00
utils.h cli: mark argv argument for command line parsing as const 2020-04-10 10:27:27 +02:00