diff options
author | Lubomir Rintel <lkundrak@v3.sk> | 2019-09-12 09:51:06 +0200 |
---|---|---|
committer | Lubomir Rintel <lkundrak@v3.sk> | 2019-09-20 12:49:21 +0200 |
commit | 25fadf8f92a1d02c19c657beddbed54900d3baaa (patch) | |
tree | 15f2b3ba82215bbef4caacb0201d8921799e8d0c | |
parent | a7dd935d87a5ff2981f8465a0c263e3db46ce9ac (diff) | |
download | NetworkManager-25fadf8f92a1d02c19c657beddbed54900d3baaa.tar.gz |
cli: add kill switch indication to "nmcli" output
There is some guess work done on the client side. Perhaps the
o.fd.NM.Device could be extended to indicate which kill switch is the
device disabled by. This could be good enough for now though.
https://gitlab.freedesktop.org/NetworkManager/NetworkManager/merge_requests/271/commits
-rw-r--r-- | clients/cli/general.c | 35 | ||||
-rw-r--r-- | clients/cli/nmcli.c | 2 | ||||
-rw-r--r-- | clients/common/nm-meta-setting-desc.h | 1 | ||||
-rw-r--r-- | man/nmcli.xml | 7 |
4 files changed, 45 insertions, 0 deletions
diff --git a/clients/cli/general.c b/clients/cli/general.c index 14502111d7..55371d13fd 100644 --- a/clients/cli/general.c +++ b/clients/cli/general.c @@ -1242,6 +1242,41 @@ device_overview (NmCli *nmc, NMDevice *device) g_string_append_printf (outbuf, "%s, ", tmp); g_free (tmp); } + + switch (nm_device_get_device_type (device)) { + case NM_DEVICE_TYPE_WIFI: + case NM_DEVICE_TYPE_OLPC_MESH: + case NM_DEVICE_TYPE_WIFI_P2P: + if (!nm_client_wireless_get_enabled (nmc->client)) { + tmp = nmc_colorize (&nmc->nmc_config, NM_META_COLOR_DEVICE_DISABLED, _("sw disabled")); + g_string_append_printf (outbuf, "%s, ", tmp); + g_free (tmp); + } + if (!nm_client_wireless_hardware_get_enabled (nmc->client)) { + tmp = nmc_colorize (&nmc->nmc_config, NM_META_COLOR_DEVICE_DISABLED, _("hw disabled")); + g_string_append_printf (outbuf, "%s, ", tmp); + g_free (tmp); + } + break; + case NM_DEVICE_TYPE_MODEM: + if ( nm_device_modem_get_current_capabilities (NM_DEVICE_MODEM (device)) + & (NM_DEVICE_MODEM_CAPABILITY_GSM_UMTS | NM_DEVICE_MODEM_CAPABILITY_CDMA_EVDO)) { + if (!nm_client_wwan_get_enabled (nmc->client)) { + tmp = nmc_colorize (&nmc->nmc_config, NM_META_COLOR_DEVICE_DISABLED, _("sw disabled")); + g_string_append_printf (outbuf, "%s, ", tmp); + g_free (tmp); + } + if (!nm_client_wwan_hardware_get_enabled (nmc->client)) { + tmp = nmc_colorize (&nmc->nmc_config, NM_META_COLOR_DEVICE_DISABLED, _("hw disabled")); + g_string_append_printf (outbuf, "%s, ", tmp); + g_free (tmp); + } + } + break; + default: + break; + } + if (nm_device_is_software (device)) g_string_append_printf (outbuf, "%s, ", _("sw")); else diff --git a/clients/cli/nmcli.c b/clients/cli/nmcli.c index 599369bf25..7eb9ef82dd 100644 --- a/clients/cli/nmcli.c +++ b/clients/cli/nmcli.c @@ -52,6 +52,7 @@ [NM_META_COLOR_DEVICE_FIRMWARE_MISSING] = "31", \ [NM_META_COLOR_DEVICE_PLUGIN_MISSING] = "31", \ [NM_META_COLOR_DEVICE_UNAVAILABLE] = "2", \ + [NM_META_COLOR_DEVICE_DISABLED] = "31", \ [NM_META_COLOR_MANAGER_RUNNING] = "32", \ [NM_META_COLOR_MANAGER_STARTING] = "33", \ [NM_META_COLOR_MANAGER_STOPPED] = "31", \ @@ -558,6 +559,7 @@ parse_color_scheme (char *palette_buffer, [NM_META_COLOR_DEVICE_FIRMWARE_MISSING] = "device-firmware-missing", [NM_META_COLOR_DEVICE_PLUGIN_MISSING] = "device-plugin-missing", [NM_META_COLOR_DEVICE_UNAVAILABLE] = "device-unavailable", + [NM_META_COLOR_DEVICE_DISABLED] = "device-disabled", [NM_META_COLOR_DEVICE_UNKNOWN] = "device-unknown", [NM_META_COLOR_MANAGER_RUNNING] = "manager-running", [NM_META_COLOR_MANAGER_STARTING] = "manager-starting", diff --git a/clients/common/nm-meta-setting-desc.h b/clients/common/nm-meta-setting-desc.h index 44cfcdc427..2f184e4945 100644 --- a/clients/common/nm-meta-setting-desc.h +++ b/clients/common/nm-meta-setting-desc.h @@ -89,6 +89,7 @@ typedef enum { NM_META_COLOR_DEVICE_FIRMWARE_MISSING, NM_META_COLOR_DEVICE_PLUGIN_MISSING, NM_META_COLOR_DEVICE_UNAVAILABLE, + NM_META_COLOR_DEVICE_DISABLED, NM_META_COLOR_DEVICE_UNKNOWN, NM_META_COLOR_MANAGER_RUNNING, NM_META_COLOR_MANAGER_STARTING, diff --git a/man/nmcli.xml b/man/nmcli.xml index e9517456f3..203337693c 100644 --- a/man/nmcli.xml +++ b/man/nmcli.xml @@ -2193,6 +2193,13 @@ It's equivalent to the <literal>+bond.options 'option=value'</literal> syntax.</ </varlistentry> <varlistentry> + <term><option>device-disabled</option></term> + <listitem> + <para>Device is disabled by software or hardware kill switch.</para> + </listitem> + </varlistentry> + + <varlistentry> <term><option>manager-running</option></term> <listitem> <para>Notice that the NetworkManager daemon is available.</para> |