NetworkManager/src/libnmc-base
Beniamino Galvani 6af2fb351c core, libnm: expose the reason for unmanaged devices
A common source for doubts and questions from users is about why
devices are unmanaged. Unfortunately NM doesn't expose that
information properly via D-Bus and so it's not available in nmcli.

The device D-Bus object has two properties that are strictly related:
"state" and "state-reason". The latter represents the reason for the
current state. Introduce new reasons to indicate the possible causes
for the unmanaged state. Note that a device can be unmanaged because
of multiple reasons at the same time, we only return one.

Before:

  $ nmcli -f GENERAL.DEVICE,GENERAL.TYPE,GENERAL.STATE,GENERAL.reason device show

  GENERAL.DEVICE:                         enp7s0
  GENERAL.TYPE:                           ethernet
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         0 (No reason given)

  GENERAL.DEVICE:                         tun0
  GENERAL.TYPE:                           tun
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         0 (No reason given)

  GENERAL.DEVICE:                         hwsim0
  GENERAL.TYPE:                           unknown
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         0 (No reason given)

After:

  $ nmcli -f GENERAL.DEVICE,GENERAL.TYPE,GENERAL.STATE,GENERAL.reason device show

  GENERAL.DEVICE:                         enp7s0
  GENERAL.TYPE:                           ethernet
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         76 (The device is unmanaged by user decision via settings plugin ("unmanaged-devices" for keyfile or "NM_CONTROLLED=no" for ifcfg-rh))

  GENERAL.DEVICE:                         tun0
  GENERAL.TYPE:                           tun
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         75 (The device is unmanaged by explicit user decision (e.g. 'nmcli device set $DEV managed no')

  GENERAL.DEVICE:                         hwsim0
  GENERAL.TYPE:                           unknown
  GENERAL.STATE:                          10 (unmanaged)
  GENERAL.REASON:                         69 (The device is unmanaged because the device type is unmanaged by default)

https://gitlab.freedesktop.org/NetworkManager/NetworkManager/-/merge_requests/1887
2024-03-20 15:25:09 +01:00
..
meson.build build: move "clients/common/" to "src/libnmc-{base,setting}/" 2021-03-02 08:38:25 +01:00
nm-client-utils.c core, libnm: expose the reason for unmanaged devices 2024-03-20 15:25:09 +01:00
nm-client-utils.h format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
nm-polkit-listener.c core: use nm_io_fcntl_setfl_update_nonblock() helper 2023-04-04 08:43:21 +02:00
nm-polkit-listener.h all: use _NM_G_TYPE_CHECK_INSTANCE_CAST() for internal uses 2022-12-16 10:55:03 +01:00
nm-secret-agent-simple.c libnmc: allow user input in ECHO mode for 2FA challenges 2024-02-21 11:31:49 +01:00
nm-secret-agent-simple.h libnmc: allow user input in ECHO mode for 2FA challenges 2024-02-21 11:31:49 +01:00
nm-vpn-helpers.c libnmc: fix openconnect option "--cafile" in nm_vpn_openconnect_authenticate_helper() 2023-05-12 13:25:58 +02:00
nm-vpn-helpers.h nmcli, nmtui: reduce duplication around openconnect auth helper 2023-05-11 13:15:53 +01:00
qrcodegen.c format: reformat source tree with clang-format 13.0 2021-11-29 09:31:09 +00:00
qrcodegen.h all: reformat code to clang shipped with Fedora 39 2023-12-06 10:37:24 +01:00
README.md all: add some README.md files describing the purpose of our sources 2021-08-19 17:51:11 +02:00

libnmc-base

A helper library on top of libnm for our clients. The "c" in "libnmc-base" stands for clients.

This has no additional dependencies on top of libnm, so any client application that uses libnm can statically link with this helper at will.

As such, this is very similar in purpose to ../libnm-client-aux-extern, the difference is only in scope.