From 537bfce2bda471c92caabd388589230200891509 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 3 Jul 2026 19:53:18 +0200 Subject: New upstream version 1.58~rc1 --- src/nmcli/common.c | 18 +++ src/nmcli/connections.c | 17 ++- src/nmcli/devices.c | 167 +++++++++++------------- src/nmcli/gen-metadata-nm-settings-nmcli.xml.in | 28 ++-- src/nmcli/general.c | 18 +++ src/nmcli/utils.c | 14 +- src/nmcli/utils.h | 5 + 7 files changed, 161 insertions(+), 106 deletions(-) (limited to 'src/nmcli') diff --git a/src/nmcli/common.c b/src/nmcli/common.c index 15a7927b..5940f2f0 100644 --- a/src/nmcli/common.c +++ b/src/nmcli/common.c @@ -156,6 +156,11 @@ _metagen_ip4_config_get_fcn(NMC_META_GENERIC_INFO_GET_FCN_ARGS) return NULL; arrc = nm_ip_config_get_wins_servers(cfg4); goto arrc_out; + case NMC_GENERIC_INFO_TYPE_IP4_CONFIG_CLAT_ADDRESS: + *out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE; + str = nm_ip_config_get_clat_address(cfg4); + NM_SET_OUT(out_is_default, !str); + return str; default: break; } @@ -184,6 +189,7 @@ const NmcMetaGenericInfo *const metagen_ip4_config[_NMC_GENERIC_INFO_TYPE_IP4_CO _METAGEN_IP4_CONFIG(NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DOMAIN, "DOMAIN"), _METAGEN_IP4_CONFIG(NMC_GENERIC_INFO_TYPE_IP4_CONFIG_SEARCHES, "SEARCHES"), _METAGEN_IP4_CONFIG(NMC_GENERIC_INFO_TYPE_IP4_CONFIG_WINS, "WINS"), + _METAGEN_IP4_CONFIG(NMC_GENERIC_INFO_TYPE_IP4_CONFIG_CLAT_ADDRESS, "CLAT-ADDRESS"), }; /*****************************************************************************/ @@ -245,6 +251,16 @@ _metagen_ip6_config_get_fcn(NMC_META_GENERIC_INFO_GET_FCN_ARGS) return NULL; arrc = nm_ip_config_get_searches(cfg6); goto arrc_out; + case NMC_GENERIC_INFO_TYPE_IP6_CONFIG_CLAT_ADDRESS: + *out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE; + str = nm_ip_config_get_clat_address(cfg6); + NM_SET_OUT(out_is_default, !str); + return str; + case NMC_GENERIC_INFO_TYPE_IP6_CONFIG_CLAT_PREF64: + *out_flags |= NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE; + str = nm_ip_config_get_clat_pref64(cfg6); + NM_SET_OUT(out_is_default, !str); + return str; default: break; } @@ -272,6 +288,8 @@ const NmcMetaGenericInfo *const metagen_ip6_config[_NMC_GENERIC_INFO_TYPE_IP6_CO _METAGEN_IP6_CONFIG(NMC_GENERIC_INFO_TYPE_IP6_CONFIG_DNS, "DNS"), _METAGEN_IP6_CONFIG(NMC_GENERIC_INFO_TYPE_IP6_CONFIG_DOMAIN, "DOMAIN"), _METAGEN_IP6_CONFIG(NMC_GENERIC_INFO_TYPE_IP6_CONFIG_SEARCHES, "SEARCHES"), + _METAGEN_IP6_CONFIG(NMC_GENERIC_INFO_TYPE_IP6_CONFIG_CLAT_ADDRESS, "CLAT-ADDRESS"), + _METAGEN_IP6_CONFIG(NMC_GENERIC_INFO_TYPE_IP6_CONFIG_CLAT_PREF64, "CLAT-PREF64"), }; /*****************************************************************************/ diff --git a/src/nmcli/connections.c b/src/nmcli/connections.c index a3b03efe..6f0356c5 100644 --- a/src/nmcli/connections.c +++ b/src/nmcli/connections.c @@ -818,8 +818,11 @@ _metagen_con_show_get_fcn(NMC_META_GENERIC_INFO_GET_FCN_ARGS) } const NmcMetaGenericInfo *const metagen_con_show[_NMC_GENERIC_INFO_TYPE_CON_SHOW_NUM + 1] = { -#define _METAGEN_CON_SHOW(type, name) \ - [type] = NMC_META_GENERIC(name, .info_type = type, .get_fcn = _metagen_con_show_get_fcn) +#define _METAGEN_CON_SHOW(type, name, ...) \ + [type] = NMC_META_GENERIC(name, \ + .info_type = type, \ + .get_fcn = _metagen_con_show_get_fcn, \ + __VA_ARGS__) _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_NAME, "NAME"), _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_UUID, "UUID"), _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_TYPE, "TYPE"), @@ -833,7 +836,7 @@ const NmcMetaGenericInfo *const metagen_con_show[_NMC_GENERIC_INFO_TYPE_CON_SHOW _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_DEVICE, "DEVICE"), _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_STATE, "STATE"), _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_ACTIVE_PATH, "ACTIVE-PATH"), - _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_PORT, "SLAVE"), + _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_PORT, "PORT", .alias = "SLAVE"), _METAGEN_CON_SHOW(NMC_GENERIC_INFO_TYPE_CON_SHOW_FILENAME, "FILENAME"), }; #define NMC_FIELDS_CON_SHOW_COMMON "NAME,UUID,TYPE,DEVICE" @@ -920,6 +923,7 @@ _metagen_con_active_general_get_fcn(NMC_META_GENERIC_INFO_GET_FCN_ARGS) * but the settings-connection profile. There is no guarantee, that they agree. */ return s_con ? nm_setting_connection_get_zone(s_con) : NULL; case NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_CONTROLLER_PATH: + case NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_MASTER_PATH: dev = nm_active_connection_get_controller(ac); return dev ? nm_object_get_path(NM_OBJECT(dev)) : NULL; default: @@ -949,6 +953,8 @@ const NmcMetaGenericInfo _METAGEN_CON_ACTIVE_GENERAL(NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_CON_PATH, "CON-PATH"), _METAGEN_CON_ACTIVE_GENERAL(NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_ZONE, "ZONE"), _METAGEN_CON_ACTIVE_GENERAL(NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_CONTROLLER_PATH, + "CONTROLLER-PATH"), + _METAGEN_CON_ACTIVE_GENERAL(NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_MASTER_PATH, "MASTER-PATH"), }; @@ -5645,6 +5651,7 @@ connection_warnings(NmCli *nmc, NMConnection *connection) guint i, found; const char *id; const char *deprecated; + gs_free char *gw_warning = NULL; deprecated = nmc_connection_check_deprecated(NM_CONNECTION(connection)); if (deprecated) @@ -5673,6 +5680,10 @@ connection_warnings(NmCli *nmc, NMConnection *connection) nm_connection_get_uuid(NM_CONNECTION(connection)), found); } + + gw_warning = nm_connection_get_unreachable_gateways_warning(connection, TRUE); + if (gw_warning) + nmc_printerr("Warning: %s.\n", gw_warning); } static void diff --git a/src/nmcli/devices.c b/src/nmcli/devices.c index 2787439e..bc24bcde 100644 --- a/src/nmcli/devices.c +++ b/src/nmcli/devices.c @@ -732,21 +732,22 @@ const NmcMetaGenericInfo *const nmc_fields_dev_wifi_list[] = { NMC_META_GENERIC("BSSID"), /* 3 */ NMC_META_GENERIC("MODE"), /* 4 */ NMC_META_GENERIC("CHAN"), /* 5 */ - NMC_META_GENERIC("FREQ"), /* 6 */ - NMC_META_GENERIC("RATE"), /* 7 */ - NMC_META_GENERIC("BANDWIDTH"), /* 8 */ - NMC_META_GENERIC("SIGNAL"), /* 9 */ - NMC_META_GENERIC("BARS"), /* 10 */ - NMC_META_GENERIC("SECURITY"), /* 11 */ - NMC_META_GENERIC("WPA-FLAGS"), /* 12 */ - NMC_META_GENERIC("RSN-FLAGS"), /* 13 */ - NMC_META_GENERIC("DEVICE"), /* 14 */ - NMC_META_GENERIC("ACTIVE"), /* 15 */ - NMC_META_GENERIC("IN-USE"), /* 16 */ - NMC_META_GENERIC("DBUS-PATH"), /* 17 */ + NMC_META_GENERIC("BAND"), /* 6 */ + NMC_META_GENERIC("FREQ"), /* 7 */ + NMC_META_GENERIC("RATE"), /* 8 */ + NMC_META_GENERIC("BANDWIDTH"), /* 9 */ + NMC_META_GENERIC("SIGNAL"), /* 10 */ + NMC_META_GENERIC("BARS"), /* 11 */ + NMC_META_GENERIC("SECURITY"), /* 12 */ + NMC_META_GENERIC("WPA-FLAGS"), /* 13 */ + NMC_META_GENERIC("RSN-FLAGS"), /* 14 */ + NMC_META_GENERIC("DEVICE"), /* 15 */ + NMC_META_GENERIC("ACTIVE"), /* 16 */ + NMC_META_GENERIC("IN-USE"), /* 17 */ + NMC_META_GENERIC("DBUS-PATH"), /* 18 */ NULL, }; -#define NMC_FIELDS_DEV_WIFI_LIST_COMMON "IN-USE,BSSID,SSID,MODE,CHAN,RATE,SIGNAL,BARS,SECURITY" +#define NMC_FIELDS_DEV_WIFI_LIST_COMMON "IN-USE,BSSID,SSID,MODE,BAND,CHAN,RATE,SIGNAL,BARS,SECURITY" #define NMC_FIELDS_DEV_WIFI_LIST_FOR_DEV_LIST "NAME," NMC_FIELDS_DEV_WIFI_LIST_COMMON const NmcMetaGenericInfo *const nmc_fields_dev_wimax_list[] = { @@ -765,17 +766,19 @@ const NmcMetaGenericInfo *const nmc_fields_dev_wimax_list[] = { const NmcMetaGenericInfo *const nmc_fields_dev_show_controller_prop[] = { NMC_META_GENERIC("NAME"), /* 0 */ NMC_META_GENERIC("SLAVES"), /* 1 */ + NMC_META_GENERIC("PORTS"), /* 2 */ NULL, }; -#define NMC_FIELDS_DEV_SHOW_CONTROLLER_PROP_COMMON "NAME,SLAVES" +#define NMC_FIELDS_DEV_SHOW_CONTROLLER_PROP_COMMON "NAME,SLAVES,PORTS" const NmcMetaGenericInfo *const nmc_fields_dev_show_team_prop[] = { NMC_META_GENERIC("NAME"), /* 0 */ NMC_META_GENERIC("SLAVES"), /* 1 */ - NMC_META_GENERIC("CONFIG"), /* 2 */ + NMC_META_GENERIC("PORTS"), /* 2 */ + NMC_META_GENERIC("CONFIG"), /* 3 */ NULL, }; -#define NMC_FIELDS_DEV_SHOW_TEAM_PROP_COMMON "NAME,SLAVES,CONFIG" +#define NMC_FIELDS_DEV_SHOW_TEAM_PROP_COMMON "NAME,SLAVES,PORTS,CONFIG" const NmcMetaGenericInfo *const nmc_fields_dev_show_vlan_prop[] = { NMC_META_GENERIC("NAME"), /* 0 */ @@ -867,7 +870,7 @@ usage(void) "]\n" " [bssid ] [name ] [private yes|no] [hidden " "yes|no]\n\n" - " wifi hotspot [ifname ] [con-name ] [ssid ] [band a|bg] " + " wifi hotspot [ifname ] [con-name ] [ssid ] [band a|bg|6GHz] " "[channel ] [password ]\n\n" " wifi rescan [ifname ] [[ssid ] ...]\n\n" " wifi show-password [ifname ]\n\n" @@ -1023,7 +1026,7 @@ usage_device_wifi(void) "It is also assumed that IP configuration is obtained via DHCP.\n" "\n" "ARGUMENTS := hotspot [ifname ] [con-name ] [ssid ]\n" - " [band a|bg] [channel ] [password ]\n" + " [band a|bg|6GHz] [channel ] [password ]\n" "\n" "Create a Wi-Fi hotspot. Use 'connection down' or 'device disconnect'\n" "to stop the hotspot.\n" @@ -1325,6 +1328,7 @@ fill_output_access_point(NMAccessPoint *ap, const APInfo *info) const char *bssid; NM80211Mode mode; char *channel_str; + const char *band_str; char *freq_str; char *ssid_str = NULL; char *ssid_hex_str = NULL; @@ -1369,6 +1373,22 @@ fill_output_access_point(NMAccessPoint *ap, const APInfo *info) rsn_flags_str = ap_wpa_rsn_flags_to_string(rsn_flags, NM_META_ACCESSOR_GET_TYPE_PRETTY); sig_bars = nmc_wifi_strength_bars(strength); + switch (nm_utils_wifi_freq_to_band(freq)) { + case NM_WIFI_BAND_2_4_GHZ: + band_str = _("2.4 GHz"); + break; + case NM_WIFI_BAND_5_GHZ: + band_str = _("5 GHz"); + break; + case NM_WIFI_BAND_6_GHZ: + band_str = _("6 GHz"); + break; + default: + case NM_WIFI_BAND_UNKNOWN: + band_str = ""; + break; + } + security_str = g_string_new(NULL); if (_ap_is_wep(ap)) { @@ -1417,18 +1437,19 @@ fill_output_access_point(NMAccessPoint *ap, const APInfo *info) : mode == NM_802_11_MODE_MESH ? _("Mesh") : _("N/A")); set_val_str(arr, 5, channel_str); - set_val_str(arr, 6, freq_str); - set_val_str(arr, 7, bitrate_str); - set_val_str(arr, 8, bandwidth_str); - set_val_str(arr, 9, strength_str); - set_val_strc(arr, 10, sig_bars); - set_val_str(arr, 11, g_string_free(security_str, FALSE)); - set_val_str(arr, 12, wpa_flags_str); - set_val_str(arr, 13, rsn_flags_str); - set_val_strc(arr, 14, info->device); - set_val_strc(arr, 15, active ? _("yes") : _("no")); - set_val_strc(arr, 16, active ? "*" : " "); - set_val_strc(arr, 17, nm_object_get_path(NM_OBJECT(ap))); + set_val_strc(arr, 6, band_str); + set_val_str(arr, 7, freq_str); + set_val_str(arr, 8, bitrate_str); + set_val_str(arr, 9, bandwidth_str); + set_val_str(arr, 10, strength_str); + set_val_strc(arr, 11, sig_bars); + set_val_str(arr, 12, g_string_free(security_str, FALSE)); + set_val_str(arr, 13, wpa_flags_str); + set_val_str(arr, 14, rsn_flags_str); + set_val_strc(arr, 15, info->device); + set_val_strc(arr, 16, active ? _("yes") : _("no")); + set_val_strc(arr, 17, active ? "*" : " "); + set_val_strc(arr, 18, nm_object_get_path(NM_OBJECT(ap))); /* Set colors */ color = wifi_signal_to_color(strength); @@ -1520,7 +1541,8 @@ print_bond_bridge_info(NMDevice *device, arr = nmc_dup_fields_array(tmpl, NMC_OF_FLAG_SECTION_PREFIX); set_val_strc(arr, 0, group_prefix); /* i.e. BOND, TEAM, BRIDGE */ - set_val_str(arr, 1, g_string_free(ports_str, FALSE)); + set_val_str(arr, 1, g_strdup(ports_str->str)); + set_val_str(arr, 2, g_string_free(ports_str, FALSE)); g_ptr_array_add(out.output_data, arr); print_data_prepare_width(out.output_data); @@ -1583,8 +1605,9 @@ print_team_info(NMDevice *device, NmCli *nmc, const char *group_prefix, const ch arr = nmc_dup_fields_array(tmpl, NMC_OF_FLAG_SECTION_PREFIX); set_val_strc(arr, 0, group_prefix); /* TEAM */ - set_val_str(arr, 1, g_string_free(ports_str, FALSE)); - set_val_str(arr, 2, sanitize_team_config(nm_device_team_get_config(NM_DEVICE_TEAM(device)))); + set_val_str(arr, 1, g_strdup(ports_str->str)); + set_val_str(arr, 2, g_string_free(ports_str, FALSE)); + set_val_str(arr, 3, sanitize_team_config(nm_device_team_get_config(NM_DEVICE_TEAM(device)))); g_ptr_array_add(out.output_data, arr); print_data_prepare_width(out.output_data); @@ -4571,10 +4594,11 @@ do_device_wifi_hotspot(const NMCCommand *cmd, NmCli *nmc, int argc, const char * } band = *argv; if (argc == 1 && nmc->complete) - nmc_complete_strings(band, "a", "bg"); - if (strcmp(band, "a") && strcmp(band, "bg")) { + nmc_complete_strings(band, "a", "bg", "6GHz"); + if (!NM_IN_STRSET(band, "a", "bg", "6GHz")) { g_string_printf(nmc->return_text, - _("Error: band argument value '%s' is invalid; use 'a' or 'bg'."), + _("Error: band argument value '%s' is invalid; use 'a', 'bg' " + "or '6GHz'."), band); nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; return; @@ -4622,7 +4646,7 @@ do_device_wifi_hotspot(const NMCCommand *cmd, NmCli *nmc, int argc, const char * nmc->return_value = NMC_RESULT_ERROR_USER_INPUT; return; } - if (!nmc_string_to_uint(channel, TRUE, 1, 5825, &value) + if (!nmc_string_to_uint(channel, TRUE, 1, G_MAXUINT32, &value) || !nm_utils_wifi_is_channel_valid(value, band)) { g_string_printf(nmc->return_text, _("Error: channel '%s' not valid for band '%s'."), @@ -4809,45 +4833,16 @@ do_device_wifi_rescan(const NMCCommand *cmd, NmCli *nmc, int argc, const char *c nmc->should_wait++; } -static void -string_append_mecard(GString *string, const char *tag, const char *text) -{ - const char *p; - bool is_hex = TRUE; - int start; - - if (!text) - return; - - g_string_append(string, tag); - start = string->len; - - for (p = text; *p; p++) { - if (!g_ascii_isxdigit(*p)) - is_hex = FALSE; - if (strchr("\\\":;,", *p)) - g_string_append_c(string, '\\'); - g_string_append_c(string, *p); - } - - if (is_hex) { - g_string_insert_c(string, start, '\"'); - g_string_append_c(string, '\"'); - } - g_string_append_c(string, ';'); -} - static void print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) { - NMSettingWireless *s_wireless; - NMSettingWirelessSecurity *s_wsec; - const char *key_mgmt = NULL; - const char *psk = NULL; - const char *type = NULL; - GBytes *ssid_bytes; - gs_free char *ssid = NULL; - nm_auto_free_gstring GString *string = NULL; + NMSettingWireless *s_wireless; + NMSettingWirelessSecurity *s_wsec; + const char *key_mgmt = NULL; + const char *psk = NULL; + GBytes *ssid_bytes; + gs_free char *ssid = NULL; + nm_auto_free_secret char *uri = NULL; s_wireless = nm_connection_get_setting_wireless(connection); g_return_if_fail(s_wireless); @@ -4858,9 +4853,6 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) g_return_if_fail(ssid); nmc_print("SSID: %s\n", ssid); - string = g_string_sized_new(64); - g_string_append(string, "WIFI:"); - s_wsec = nm_connection_get_setting_wireless_security(connection); if (s_wsec) { key_mgmt = nm_setting_wireless_security_get_key_mgmt(s_wsec); @@ -4868,33 +4860,30 @@ print_wifi_connection(const NmcConfig *nmc_config, NMConnection *connection) } if (key_mgmt == NULL) { - type = "nopass"; nmc_print("%s: %s\n", _("Security"), _("None")); } else if (strcmp(key_mgmt, "none") == 0 || strcmp(key_mgmt, "ieee8021x") == 0) { - type = "WEP"; nmc_print("%s: WEP\n", _("Security")); } else if (strcmp(key_mgmt, "wpa-none") == 0 || strcmp(key_mgmt, "wpa-psk") == 0 || strcmp(key_mgmt, "sae") == 0) { - type = "WPA"; nmc_print("%s: WPA\n", _("Security")); } else if (strcmp(key_mgmt, "owe") == 0) { - type = "nopass"; nmc_print("%s: OWE\n", _("Security")); } - if (psk) + if (psk && psk[0]) { nmc_print("%s: %s\n", _("Password"), psk); + } else if (nmc_wifi_key_mgmt_uses_psk(key_mgmt)) { + /* A QR code for a secured network without its password connects to + * nothing, so don't print one. */ + nmc_printerr( + _("Warning: cannot read the Wi-Fi password due to insufficient privileges.\n")); + return; + } - string_append_mecard(string, "T:", type); - string_append_mecard(string, "S:", ssid); - string_append_mecard(string, "P:", psk); - - if (nm_setting_wireless_get_hidden(s_wireless)) - g_string_append(string, "H:true;"); + uri = nmc_wifi_qr_uri_new(ssid, key_mgmt, psk, nm_setting_wireless_get_hidden(s_wireless)); - g_string_append_c(string, ';'); if (nmc_config->use_colors) - nmc_print_qrcode(string->str); + nmc_print_qrcode(uri); nmc_print("\n"); } diff --git a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in index 7a9f4e9c..801c760d 100644 --- a/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in +++ b/src/nmcli/gen-metadata-nm-settings-nmcli.xml.in @@ -33,9 +33,9 @@ format="string" values="infrastructure, adhoc, ap, mesh" /> + values="a, bg, 6GHz" /> @@ -1482,9 +1482,13 @@ nmcli-description="The Vendor Class Identifier DHCP option (60). Special characters in the data string may be escaped using C-style escapes, nevertheless this property cannot contain nul bytes. If the per-profile value is unspecified (the default), a global connection default gets consulted. If still unspecified, the DHCP option is not sent to the server." format="string" /> + values="default (-1), no (0), yes (1), auto (2)" /> + @@ -1609,10 +1613,10 @@ nmcli-description="A IPv6 address followed by a slash and a prefix length. If set, the value is sent to the DHCPv6 server as hint indicating the prefix delegation (IA_PD) we want to receive. To only hint a prefix length without prefix, set the address part to the zero address (for example "::/60")." format="string" /> name; } +static const char * +_meta_type_nmc_generic_info_get_alias(const NMMetaAbstractInfo *abstract_info) +{ + const NmcMetaGenericInfo *info = (const NmcMetaGenericInfo *) abstract_info; + + return info->alias; +} + static const NMMetaAbstractInfo *const * _meta_type_nmc_generic_info_get_nested(const NMMetaAbstractInfo *abstract_info, guint *out_len, @@ -101,6 +109,7 @@ _meta_type_nmc_generic_info_get_fcn(const NMMetaAbstractInfo *abstract_info, const NMMetaType nmc_meta_type_generic_info = { .type_name = "nmc-generic-info", .get_name = _meta_type_nmc_generic_info_get_name, + .get_alias = _meta_type_nmc_generic_info_get_alias, .get_nested = _meta_type_nmc_generic_info_get_nested, .get_fcn = _meta_type_nmc_generic_info_get_fcn, }; @@ -1103,8 +1112,9 @@ _print_fill(const NmcConfig *nmc_config, nm_assert(!to_free || value == to_free); - if ((is_default && nmc_config->overview) - || NM_FLAGS_HAS(text_out_flags, NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE)) { + if (is_default + && (nmc_config->overview + || NM_FLAGS_HAS(text_out_flags, NM_META_ACCESSOR_GET_OUT_FLAGS_HIDE))) { /* don't mark the entry for display. This is to shorten the output in case * the property is the default value. But we only do that, if the user * opts in to this behavior (-overview), or of the property marks itself diff --git a/src/nmcli/utils.h b/src/nmcli/utils.h index b2539bf4..effb3340 100644 --- a/src/nmcli/utils.h +++ b/src/nmcli/utils.h @@ -111,6 +111,7 @@ typedef enum { NMC_GENERIC_INFO_TYPE_IP4_CONFIG_DOMAIN, NMC_GENERIC_INFO_TYPE_IP4_CONFIG_SEARCHES, NMC_GENERIC_INFO_TYPE_IP4_CONFIG_WINS, + NMC_GENERIC_INFO_TYPE_IP4_CONFIG_CLAT_ADDRESS, _NMC_GENERIC_INFO_TYPE_IP4_CONFIG_NUM, NMC_GENERIC_INFO_TYPE_IP6_CONFIG_ADDRESS = 0, @@ -119,6 +120,8 @@ typedef enum { NMC_GENERIC_INFO_TYPE_IP6_CONFIG_DNS, NMC_GENERIC_INFO_TYPE_IP6_CONFIG_DOMAIN, NMC_GENERIC_INFO_TYPE_IP6_CONFIG_SEARCHES, + NMC_GENERIC_INFO_TYPE_IP6_CONFIG_CLAT_ADDRESS, + NMC_GENERIC_INFO_TYPE_IP6_CONFIG_CLAT_PREF64, _NMC_GENERIC_INFO_TYPE_IP6_CONFIG_NUM, NMC_GENERIC_INFO_TYPE_DHCP_CONFIG_OPTION = 0, @@ -154,6 +157,7 @@ typedef enum { NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_CON_PATH, NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_ZONE, NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_CONTROLLER_PATH, + NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_MASTER_PATH, _NMC_GENERIC_INFO_TYPE_CON_ACTIVE_GENERAL_NUM, NMC_GENERIC_INFO_TYPE_CON_VPN_TYPE = 0, @@ -257,6 +261,7 @@ struct _NmcMetaGenericInfo { NmcGenericInfoType info_type; const char *name; const char *name_header; + const char *alias; const NmcMetaGenericInfo *const *nested; #define NMC_META_GENERIC_INFO_GET_FCN_ARGS \ -- cgit 1.3.0-6-gf8a5