diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2015-04-30 11:52:04 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2015-07-22 13:52:45 +0200 |
commit | e16c0682898bfa899d440b6325f13e9546981614 (patch) | |
tree | 2f3304e7f8691c46e416001169cadd665dbb6f70 | |
parent | 77a7e913a20f44f417c8f96de3086d48beec5fe7 (diff) | |
download | NetworkManager-e16c0682898bfa899d440b6325f13e9546981614.tar.gz |
cli: add 'metered' property to device
(cherry picked from commit f208e7030f9b305bee4063d541163e47e2f51c06)
-rw-r--r-- | clients/cli/common.c | 17 | ||||
-rw-r--r-- | clients/cli/common.h | 1 | ||||
-rw-r--r-- | clients/cli/devices.c | 5 |
3 files changed, 22 insertions, 1 deletions
diff --git a/clients/cli/common.c b/clients/cli/common.c index 97d0bb940e..35676d0f2b 100644 --- a/clients/cli/common.c +++ b/clients/cli/common.c @@ -522,6 +522,23 @@ nmc_device_state_to_string (NMDeviceState state) } const char * +nmc_device_metered_to_string (NMMetered value) +{ + switch (value) { + case NM_METERED_YES: + return _("yes"); + case NM_METERED_NO: + return _("no"); + case NM_METERED_GUESS_YES: + return _("yes (guessed)"); + case NM_METERED_GUESS_NO: + return _("no (guessed)"); + default: + return _("unknown"); + } +} + +const char * nmc_device_reason_to_string (NMDeviceStateReason reason) { switch (reason) { diff --git a/clients/cli/common.h b/clients/cli/common.h index 8bb043f4d7..bb3f44e851 100644 --- a/clients/cli/common.h +++ b/clients/cli/common.h @@ -35,6 +35,7 @@ NMIPRoute *nmc_parse_and_build_route (int family, const char *first, const char const char * nmc_device_state_to_string (NMDeviceState state); const char * nmc_device_reason_to_string (NMDeviceStateReason reason); +const char * nmc_device_metered_to_string (NMMetered value); char ** nmc_vlan_parse_priority_maps (const char *priority_map, diff --git a/clients/cli/devices.c b/clients/cli/devices.c index 979c590635..41564a5ab7 100644 --- a/clients/cli/devices.c +++ b/clients/cli/devices.c @@ -78,11 +78,12 @@ static NmcOutputField nmc_fields_dev_show_general[] = { {"CONNECTION", N_("CONNECTION"), 20}, /* 20 */ {"CON-UUID", N_("CON-UUID"), 38}, /* 21 */ {"CON-PATH", N_("CON-PATH"), 51}, /* 22 */ + {"METERED", N_("METERED"), 10}, /* 23 */ {NULL, NULL, 0} }; #define NMC_FIELDS_DEV_SHOW_GENERAL_ALL "NAME,DEVICE,TYPE,NM-TYPE,VENDOR,PRODUCT,DRIVER,DRIVER-VERSION,FIRMWARE-VERSION,HWADDR,MTU,"\ "STATE,REASON,UDI,IP-IFACE,IS-SOFTWARE,NM-MANAGED,AUTOCONNECT,FIRMWARE-MISSING,PHYS-PORT-ID,"\ - "CONNECTION,CON-UUID,CON-PATH" + "CONNECTION,CON-UUID,CON-PATH,METERED" #define NMC_FIELDS_DEV_SHOW_GENERAL_COMMON "NAME,DEVICE,TYPE,VENDOR,PRODUCT,DRIVER,HWADDR,STATE" /* Available fields for 'device show' - CONNECTIONS part */ @@ -858,6 +859,8 @@ show_device_info (NMDevice *device, NmCli *nmc) set_val_strc (arr, 20, get_active_connection_id (device)); set_val_strc (arr, 21, acon ? nm_active_connection_get_uuid (acon) : NULL); set_val_strc (arr, 22, acon ? nm_object_get_path (NM_OBJECT (acon)) : NULL); + set_val_strc (arr, 23, nmc_device_metered_to_string (nm_device_get_metered (device))); + g_ptr_array_add (nmc->output_data, arr); print_data (nmc); /* Print all data */ |