nmcli: add BRIDGE.PORTS, TEAM.PORTS and GENERAL.CONTROLLER-PATH fields

They show the same than the old BRIDGE/TEAM.SLAVES and GENERAL.MASTER-PATH.
We missed this when we did the changes in favour of conscious language.
Instead of replacing them, we add a new field that will show the same
value with the new name. This way we avoid breaking users doing
`nmcli -f BRIDGE.SLAVES` or `nmcli ... | grep SLAVES`.
This commit is contained in:
Íñigo Huguet 2026-02-26 12:44:41 +01:00
parent 1a2fec62f0
commit ff1d435096
5 changed files with 802 additions and 618 deletions

View file

@ -920,6 +920,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 +950,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"),
};

View file

@ -766,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 */
@ -1537,7 +1539,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);
@ -1600,8 +1603,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);

View file

@ -157,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,

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff