summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2019-09-12 09:51:06 +0200
committerLubomir Rintel <lkundrak@v3.sk>2019-09-12 09:51:06 +0200
commit0a7c87ce4a44289e6d94489e3a800d3a63bf5fd8 (patch)
tree38b264cf5c0a27c98be30d1f5f2b30f8d2a781b3
parent4af856a71bca00c396b0e41fb0bd9f01b6a36a36 (diff)
downloadNetworkManager-lr/nmcli-kill-switch.tar.gz
cli: add kill switch indication to "nmcli" outputlr/nmcli-kill-switch
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.
-rw-r--r--clients/cli/general.c35
-rw-r--r--clients/cli/nmcli.c2
-rw-r--r--clients/common/nm-meta-setting-desc.h1
-rw-r--r--man/nmcli.xml7
4 files changed, 45 insertions, 0 deletions
diff --git a/clients/cli/general.c b/clients/cli/general.c
index b70edf9217..a6230cc4de 100644
--- a/clients/cli/general.c
+++ b/clients/cli/general.c
@@ -1145,6 +1145,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>