NetworkManager/clients/cli
Thomas Haller 8bd6d2a63e 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)
2020-10-13 21:47:14 +02: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-10-13 21:47:14 +02:00
connections.h cli: show external connection in different color 2020-06-10 19:45:46 +02:00
devices.c cli: fix leak in do_device_modify() and minor cleanup 2020-07-13 17:20:48 +02:00
devices.h cli: show external connection in different color 2020-06-10 19:45:46 +02:00
general.c cli: show differnt text for state of externally connected devices 2020-06-10 19:45:47 +02:00
generate-docs-nm-settings-nmcli.c docs: show aliases for settings in man nm-settings-nmcli 2020-06-12 14:01:26 +02:00
meson.build docs: generate nm-settings-docs-nmcli.xml based on nmcli meta data 2020-06-11 10:53:50 +02:00
nmcli-completion cli: make nmcli do its own command completion 2017-02-13 16:32:15 +01:00
nmcli.c cli: show external connection in different color 2020-06-10 19:45:46 +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-16 10:52:45 +02:00
utils.h cli: add nmc_meta_generic_get_str_i18n_null() helper 2020-07-03 15:09:20 +02:00