cli: get IP/DHCP config directly from the NMActiveConnection (rh #1036132)

Now that NMActiveConnection has IP and DHCP config info, use that
directly in "nmcli con show active" rather than getting it from the
connection's device; this way, we get the right info for VPN
connections as well.
This commit is contained in:
Dan Winship
2013-12-18 11:49:39 -05:00
parent 4783f43c53
commit f1f4f32c02

View File

@@ -941,66 +941,38 @@ nmc_active_connection_detail (NMActiveConnection *acon, NmCli *nmc)
/* IP4 */ /* IP4 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[1].name) == 0) { if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[1].name) == 0) {
const GPtrArray *devices; gboolean b1 = FALSE;
int j; NMIP4Config *cfg4 = nm_active_connection_get_ip4_config (acon);
devices = nm_active_connection_get_devices (acon); b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
for (j = 0; devices && (j < devices->len); j++) { was_output = was_output || b1;
gboolean b1 = FALSE;
NMDevice *device = g_ptr_array_index (devices, j);
NMIP4Config *cfg4 = nm_device_get_ip4_config (device);
b1 = print_ip4_config (cfg4, nmc, "IP4", group_fld);
was_output = was_output || b1;
}
} }
/* DHCP4 */ /* DHCP4 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[2].name) == 0) { if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[2].name) == 0) {
const GPtrArray *devices; gboolean b1 = FALSE;
int j; NMDHCP4Config *dhcp4 = nm_active_connection_get_dhcp4_config (acon);
devices = nm_active_connection_get_devices (acon); b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
for (j = 0; devices && (j < devices->len); j++) { was_output = was_output || b1;
gboolean b1 = FALSE;
NMDevice *device = g_ptr_array_index (devices, j);
NMDHCP4Config *dhcp4 = nm_device_get_dhcp4_config (device);
b1 = print_dhcp4_config (dhcp4, nmc, "DHCP4", group_fld);
was_output = was_output || b1;
}
} }
/* IP6 */ /* IP6 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[3].name) == 0) { if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[3].name) == 0) {
const GPtrArray *devices; gboolean b1 = FALSE;
int j; NMIP6Config *cfg6 = nm_active_connection_get_ip6_config (acon);
devices = nm_active_connection_get_devices (acon); b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
for (j = 0; devices && (j < devices->len); j++) { was_output = was_output || b1;
gboolean b1 = FALSE;
NMDevice *device = g_ptr_array_index (devices, j);
NMIP6Config *cfg6 = nm_device_get_ip6_config (device);
b1 = print_ip6_config (cfg6, nmc, "IP6", group_fld);
was_output = was_output || b1;
}
} }
/* DHCP6 */ /* DHCP6 */
if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[4].name) == 0) { if (strcasecmp (nmc_fields_con_active_details_groups[group_idx].name, nmc_fields_con_active_details_groups[4].name) == 0) {
const GPtrArray *devices; gboolean b1 = FALSE;
int j; NMDHCP6Config *dhcp6 = nm_active_connection_get_dhcp6_config (acon);
devices = nm_active_connection_get_devices (acon); b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
for (j = 0; devices && (j < devices->len); j++) { was_output = was_output || b1;
gboolean b1 = FALSE;
NMDevice *device = g_ptr_array_index (devices, j);
NMDHCP6Config *dhcp6 = nm_device_get_dhcp6_config (device);
b1 = print_dhcp6_config (dhcp6, nmc, "DHCP6", group_fld);
was_output = was_output || b1;
}
} }
/* VPN */ /* VPN */