diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2023-03-03 12:03:15 +0100 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2023-03-03 12:04:38 +0100 |
commit | aa6647214655230b8ec514fd40e4b9187814aa8d (patch) | |
tree | d7ab97930321432888d6cfa3ca97f6dfd39cbcd0 | |
parent | 992e39e048f28cd83004ec5232f009c3cd16d292 (diff) | |
download | NetworkManager-bg/tmp.tar.gz |
platform: fix test_link_set_properties()bg/tmp
The link object is no longer valid after the cache gets updated in
nm_platform_link_change().
Fixes: e02fd76d9fce ('platform: support changing link properties')
-rw-r--r-- | src/core/platform/tests/test-link.c | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/core/platform/tests/test-link.c b/src/core/platform/tests/test-link.c index eb351eaa7d..c38fde42b5 100644 --- a/src/core/platform/tests/test-link.c +++ b/src/core/platform/tests/test-link.c @@ -2588,6 +2588,7 @@ test_link_set_properties(void) const NMPlatformLink *link; NMPlatformLinkProps props; NMPlatformLinkChangeFlags flags; + int ifindex; props = (NMPlatformLinkProps){ .tx_queue_length = 599, @@ -2597,10 +2598,10 @@ test_link_set_properties(void) flags = NM_PLATFORM_LINK_CHANGE_TX_QUEUE_LENGTH | NM_PLATFORM_LINK_CHANGE_GSO_MAX_SIZE | NM_PLATFORM_LINK_CHANGE_GSO_MAX_SEGMENTS; - link = nmtstp_link_dummy_add(NM_PLATFORM_GET, FALSE, "dummy1"); - g_assert(nm_platform_link_change(NM_PLATFORM_GET, link->ifindex, &props, flags)); + ifindex = nmtstp_link_dummy_add(NM_PLATFORM_GET, FALSE, "dummy1")->ifindex; + g_assert(nm_platform_link_change(NM_PLATFORM_GET, ifindex, &props, flags)); - link = nmtstp_link_get(NM_PLATFORM_GET, link->ifindex, "dummy1"); + link = nmtstp_link_get(NM_PLATFORM_GET, ifindex, "dummy1"); g_assert(link); g_assert_cmpint(link->link_props.tx_queue_length, ==, 599); g_assert_cmpint(link->link_props.gso_max_size, ==, 10001); |