mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-04 22:20:27 +01:00
cli: get connection ID straight from the active connection
Static connection profile may not be available and using active conection is easier anyway.
This commit is contained in:
parent
e130415f2b
commit
e0c8848f2e
1 changed files with 1 additions and 13 deletions
|
|
@ -685,25 +685,13 @@ construct_header_name (const char *base, const char *spec)
|
|||
static const char *
|
||||
get_active_connection_id (NMDevice *device)
|
||||
{
|
||||
const GPtrArray *avail_cons;
|
||||
NMActiveConnection *ac;
|
||||
const char *ac_uuid;
|
||||
int i;
|
||||
|
||||
ac = nm_device_get_active_connection (device);
|
||||
if (!ac)
|
||||
return NULL;
|
||||
ac_uuid = nm_active_connection_get_uuid (ac);
|
||||
|
||||
avail_cons = nm_device_get_available_connections (device);
|
||||
for (i = 0; i < avail_cons->len; i++) {
|
||||
NMRemoteConnection *candidate = g_ptr_array_index (avail_cons, i);
|
||||
const char *test_uuid = nm_connection_get_uuid (NM_CONNECTION (candidate));
|
||||
|
||||
if (g_strcmp0 (ac_uuid, test_uuid) == 0)
|
||||
return nm_connection_get_id (NM_CONNECTION (candidate));
|
||||
}
|
||||
return NULL;
|
||||
return nm_active_connection_get_id (ac);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue