diff options
| author | Michael Biebl <biebl@debian.org> | 2024-01-25 09:46:18 +0100 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2024-01-25 09:46:18 +0100 |
| commit | 70e18d99b8e3e77bb37e218d7ac582130156f8ef (patch) | |
| tree | d40c587e6d3f0e094ff558e415f1bb9803643214 /src/core/platform | |
| parent | d4d8b2b91f7ba000d97a8b2aab48c85000c11314 (diff) | |
New upstream version 1.45.90 upstream/1.45.90
Diffstat (limited to 'src/core/platform')
| -rw-r--r-- | src/core/platform/nm-fake-platform.c | 8 | ||||
| -rw-r--r-- | src/core/platform/tests/test-common.h | 2 | ||||
| -rw-r--r-- | src/core/platform/tests/test-link.c | 41 | ||||
| -rw-r--r-- | src/core/platform/tests/test-platform-general.c | 2 |
4 files changed, 41 insertions, 12 deletions
diff --git a/src/core/platform/nm-fake-platform.c b/src/core/platform/nm-fake-platform.c index f6f377d4..74bbe4fb 100644 --- a/src/core/platform/nm-fake-platform.c +++ b/src/core/platform/nm-fake-platform.c @@ -720,6 +720,14 @@ link_change(NMPlatform *platform, obj_tmp->link.port_data.bond.prio = port_data->bond.prio; link_set_obj(platform, device, obj_tmp); return TRUE; + case NM_PORT_KIND_BRIDGE: + obj_tmp = nmp_object_clone(device->obj, FALSE); + obj_tmp->link.port_kind = NM_PORT_KIND_BRIDGE; + obj_tmp->link.port_data.bridge.path_cost = port_data->bridge.path_cost; + obj_tmp->link.port_data.bridge.priority = port_data->bridge.priority; + obj_tmp->link.port_data.bridge.hairpin = port_data->bridge.hairpin; + link_set_obj(platform, device, obj_tmp); + return TRUE; case NM_PORT_KIND_NONE: return TRUE; } diff --git a/src/core/platform/tests/test-common.h b/src/core/platform/tests/test-common.h index 2802d8fd..12d6e7ce 100644 --- a/src/core/platform/tests/test-common.h +++ b/src/core/platform/tests/test-common.h @@ -32,7 +32,7 @@ * Normalize the requested_value to the kernel_value, if it look as if a rounding * error happens. If the difference is larger than +/- 1, no normalization happens! */ \ \ - ((_requested_value >= (NM_MAX(_kernel_value, 1) - 1)) \ + ((_requested_value >= (NM_MAX(_kernel_value, (typeof(_kernel_value)) 1) - 1)) \ && (_requested_value <= (NM_MIN(_kernel_value, ~((typeof(_kernel_value)) 0) - 1) + 1))) \ ? _kernel_value \ : _requested_value; \ diff --git a/src/core/platform/tests/test-link.c b/src/core/platform/tests/test-link.c index 8a54ac48..c931605b 100644 --- a/src/core/platform/tests/test-link.c +++ b/src/core/platform/tests/test-link.c @@ -230,7 +230,6 @@ test_port(int controller, int port_type, SignalData *controller_changed) link_callback, SLAVE_NAME); SignalData *link_changed, *link_removed; - char *value; NMLinkType controller_type = nm_platform_link_get_type(NM_PLATFORM_GET, controller); gboolean test_link_changed_signal_arg1; gboolean test_link_changed_signal_arg2; @@ -296,7 +295,7 @@ test_port(int controller, int port_type, SignalData *controller_changed) .prio = prio_has ? 6 : 0, }; - g_assert(nm_platform_link_change(NM_PLATFORM_GET, ifindex_port, NULL, &bond_port, 0)); + g_assert(nm_platform_link_change(NM_PLATFORM_GET, ifindex_port, NULL, &bond_port, NULL, 0)); accept_signals(link_changed, 1, 3); link = nmtstp_link_get(NM_PLATFORM_GET, ifindex_port, SLAVE_NAME); @@ -306,13 +305,35 @@ test_port(int controller, int port_type, SignalData *controller_changed) } else if (controller_type == NM_LINK_TYPE_BRIDGE) { /* Skip this part for nm-fake-platform */ if (nmtstp_is_root_test() && nmtstp_is_sysfs_writable()) { - g_assert(nm_platform_sysctl_slave_set_option(NM_PLATFORM_GET, - ifindex_port, - "priority", - "614")); - value = nm_platform_sysctl_slave_get_option(NM_PLATFORM_GET, ifindex_port, "priority"); - g_assert_cmpstr(value, ==, "614"); - g_free(value); + NMPlatformLinkBridgePort bridge_port; + const NMPlatformLink *link; + const NMPlatformLnkBridge *lnk; + + link = nmtstp_link_get_typed(NM_PLATFORM_GET, 0, SLAVE_NAME, NM_LINK_TYPE_DUMMY); + g_assert(link); + + lnk = nm_platform_link_get_lnk_bridge(NM_PLATFORM_GET, controller, NULL); + g_assert(lnk); + + bridge_port = (NMPlatformLinkBridgePort){ + .path_cost = 100, + .priority = 614, + .hairpin = 0, + }; + + g_assert(nm_platform_link_change(NM_PLATFORM_GET, + ifindex_port, + NULL, + NULL, + &bridge_port, + 0)); + accept_signals(link_changed, 1, 3); + + link = nmtstp_link_get(NM_PLATFORM_GET, ifindex_port, SLAVE_NAME); + g_assert(link); + g_assert_cmpint(link->port_data.bridge.path_cost, ==, 100); + g_assert_cmpint(link->port_data.bridge.priority, ==, 614); + g_assert_cmpint(link->port_data.bridge.hairpin, ==, 0); } } @@ -2692,7 +2713,7 @@ test_link_set_properties(void) | NM_PLATFORM_LINK_CHANGE_GSO_MAX_SEGMENTS; ifindex = nmtstp_link_dummy_add(NM_PLATFORM_GET, FALSE, "dummy1")->ifindex; - g_assert(nm_platform_link_change(NM_PLATFORM_GET, ifindex, &props, NULL, flags)); + g_assert(nm_platform_link_change(NM_PLATFORM_GET, ifindex, &props, NULL, NULL, flags)); link = nmtstp_link_get(NM_PLATFORM_GET, ifindex, "dummy1"); g_assert(link); diff --git a/src/core/platform/tests/test-platform-general.c b/src/core/platform/tests/test-platform-general.c index cebd44f6..fd6aae82 100644 --- a/src/core/platform/tests/test-platform-general.c +++ b/src/core/platform/tests/test-platform-general.c @@ -44,7 +44,7 @@ test_link_get_all(void) platform = nm_linux_platform_new(NULL, TRUE, NM_PLATFORM_NETNS_SUPPORT_DEFAULT, TRUE); - links = nm_platform_link_get_all(platform, TRUE); + links = nm_platform_link_get_all(platform); } /*****************************************************************************/ |