diff options
| author | Michael Biebl <biebl@debian.org> | 2024-08-09 18:57:15 +0200 |
|---|---|---|
| committer | Michael Biebl <biebl@debian.org> | 2024-08-09 18:57:15 +0200 |
| commit | e96d74409128c6a977e31f24fad9b267d2feb9a1 (patch) | |
| tree | 12dad71135c6c291de457568cb973208ea8a0024 /src/core/platform | |
| parent | 45a364c60a9d6d34e614c4f1f507c69336ad1e69 (diff) | |
New upstream version 1.48.8 upstream/1.48.8
Diffstat (limited to 'src/core/platform')
| -rw-r--r-- | src/core/platform/nm-fake-platform.c | 54 | ||||
| -rw-r--r-- | src/core/platform/tests/test-link.c | 63 |
2 files changed, 59 insertions, 58 deletions
diff --git a/src/core/platform/nm-fake-platform.c b/src/core/platform/nm-fake-platform.c index 74bbe4fb..6a64746e 100644 --- a/src/core/platform/nm-fake-platform.c +++ b/src/core/platform/nm-fake-platform.c @@ -199,14 +199,14 @@ link_add_prepare(NMPlatform *platform, NMFakePlatformLink *device, NMPObject *ob if (NM_FLAGS_HAS(obj_tmp->link.n_ifi_flags, IFF_UP)) { NMPLookup lookup; NMDedupMultiIter iter; - const NMPObject *slave_candidate = NULL; + const NMPObject *port_candidate = NULL; nmp_cache_iter_for_each ( &iter, nmp_cache_lookup(nm_platform_get_cache(platform), nmp_lookup_init_obj_type(&lookup, NMP_OBJECT_TYPE_LINK)), - &slave_candidate) { - if (nmp_cache_link_connected_for_slave(obj_tmp->link.ifindex, slave_candidate)) { + &port_candidate) { + if (nmp_cache_link_connected_for_port(obj_tmp->link.ifindex, port_candidate)) { connected = TRUE; break; } @@ -589,11 +589,11 @@ link_changed(NMPlatform *platform, ip6_address_delete(platform, device->obj->link.ifindex, device->ip6_lladdr, 64); } - if (device->obj->link.master) { - NMFakePlatformLink *master; + if (device->obj->link.controller) { + NMFakePlatformLink *controller; - master = link_get(platform, device->obj->link.master); - link_set_obj(platform, master, NULL); + controller = link_get(platform, device->obj->link.controller); + link_set_obj(platform, controller, NULL); } } @@ -736,20 +736,20 @@ link_change(NMPlatform *platform, } static gboolean -link_enslave(NMPlatform *platform, int master, int slave) +link_attach_port(NMPlatform *platform, int controller, int port) { - NMFakePlatformLink *device = link_get(platform, slave); - NMFakePlatformLink *master_device = link_get(platform, master); + NMFakePlatformLink *device = link_get(platform, port); + NMFakePlatformLink *controller_device = link_get(platform, controller); g_return_val_if_fail(device, FALSE); - g_return_val_if_fail(master_device, FALSE); + g_return_val_if_fail(controller_device, FALSE); - if (device->obj->link.master != master) { + if (device->obj->link.controller != controller) { nm_auto_nmpobj NMPObject *obj_tmp = NULL; - obj_tmp = nmp_object_clone(device->obj, FALSE); - obj_tmp->link.master = master; - if (NM_IN_SET(master_device->obj->link.type, NM_LINK_TYPE_BOND, NM_LINK_TYPE_TEAM)) + obj_tmp = nmp_object_clone(device->obj, FALSE); + obj_tmp->link.controller = controller; + if (NM_IN_SET(controller_device->obj->link.type, NM_LINK_TYPE_BOND, NM_LINK_TYPE_TEAM)) obj_tmp->link.n_ifi_flags = NM_FLAGS_SET(device->obj->link.n_ifi_flags, IFF_UP); link_set_obj(platform, device, obj_tmp); } @@ -758,21 +758,21 @@ link_enslave(NMPlatform *platform, int master, int slave) } static gboolean -link_release(NMPlatform *platform, int master_idx, int slave_idx) +link_release_port(NMPlatform *platform, int controller_idx, int port_idx) { - NMFakePlatformLink *master = link_get(platform, master_idx); - NMFakePlatformLink *slave = link_get(platform, slave_idx); - nm_auto_nmpobj NMPObject *obj_tmp = NULL; + NMFakePlatformLink *controller = link_get(platform, controller_idx); + NMFakePlatformLink *port = link_get(platform, port_idx); + nm_auto_nmpobj NMPObject *obj_tmp = NULL; - g_return_val_if_fail(master, FALSE); - g_return_val_if_fail(slave, FALSE); + g_return_val_if_fail(controller, FALSE); + g_return_val_if_fail(port, FALSE); - if (slave->obj->link.master != master->obj->link.ifindex) + if (port->obj->link.controller != controller->obj->link.ifindex) return FALSE; - obj_tmp = nmp_object_clone(slave->obj, FALSE); - obj_tmp->link.master = 0; - link_set_obj(platform, slave, obj_tmp); + obj_tmp = nmp_object_clone(port->obj, FALSE); + obj_tmp->link.controller = 0; + link_set_obj(platform, port, obj_tmp); return TRUE; } @@ -1438,8 +1438,8 @@ nm_fake_platform_class_init(NMFakePlatformClass *klass) platform_class->link_supports_vlans = link_supports_vlans; platform_class->link_supports_sriov = link_supports_sriov; - platform_class->link_enslave = link_enslave; - platform_class->link_release = link_release; + platform_class->link_attach_port = link_attach_port; + platform_class->link_release_port = link_release_port; platform_class->link_vlan_change = link_vlan_change; diff --git a/src/core/platform/tests/test-link.c b/src/core/platform/tests/test-link.c index 1d0bfdbe..9f63b896 100644 --- a/src/core/platform/tests/test-link.c +++ b/src/core/platform/tests/test-link.c @@ -27,7 +27,7 @@ #define DUMMY_TYPEDESC "dummy" #define BOGUS_NAME "nm-bogus-device" #define BOGUS_IFINDEX INT_MAX -#define SLAVE_NAME "nm-test-slave" +#define PORT_NAME "nm-test-port" #define PARENT_NAME "nm-test-parent" #define VLAN_ID 4077 #define VLAN_FLAGS 0 @@ -228,7 +228,7 @@ test_port(int controller, int port_type, SignalData *controller_changed) SignalData *link_added = add_signal_ifname(NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_ADDED, link_callback, - SLAVE_NAME); + PORT_NAME); SignalData *link_changed, *link_removed; NMLinkType controller_type = nm_platform_link_get_type(NM_PLATFORM_GET, controller); gboolean test_link_changed_signal_arg1; @@ -236,8 +236,8 @@ test_port(int controller, int port_type, SignalData *controller_changed) g_assert(NM_IN_SET(controller_type, NM_LINK_TYPE_TEAM, NM_LINK_TYPE_BOND, NM_LINK_TYPE_BRIDGE)); - g_assert(software_add(port_type, SLAVE_NAME)); - ifindex_port = nm_platform_link_get_ifindex(NM_PLATFORM_GET, SLAVE_NAME); + g_assert(software_add(port_type, PORT_NAME)); + ifindex_port = nm_platform_link_get_ifindex(NM_PLATFORM_GET, PORT_NAME); g_assert(ifindex_port > 0); link_changed = add_signal_ifindex(NM_PLATFORM_SIGNAL_LINK_CHANGED, NM_PLATFORM_SIGNAL_CHANGED, @@ -260,8 +260,8 @@ test_port(int controller, int port_type, SignalData *controller_changed) /* Attach port */ link_changed->ifindex = ifindex_port; - g_assert(nm_platform_link_enslave(NM_PLATFORM_GET, controller, ifindex_port)); - g_assert_cmpint(nm_platform_link_get_master(NM_PLATFORM_GET, ifindex_port), ==, controller); + g_assert(nm_platform_link_attach_port(NM_PLATFORM_GET, controller, ifindex_port)); + g_assert_cmpint(nm_platform_link_get_controller(NM_PLATFORM_GET, ifindex_port), ==, controller); accept_signals(link_changed, 1, 3); accept_signals(controller_changed, 0, 2); @@ -279,7 +279,7 @@ test_port(int controller, int port_type, SignalData *controller_changed) const NMPlatformLink *link; const NMPlatformLnkBond *lnk; - link = nmtstp_link_get_typed(NM_PLATFORM_GET, 0, SLAVE_NAME, NM_LINK_TYPE_DUMMY); + link = nmtstp_link_get_typed(NM_PLATFORM_GET, 0, PORT_NAME, NM_LINK_TYPE_DUMMY); g_assert(link); lnk = nm_platform_link_get_lnk_bond(NM_PLATFORM_GET, controller, NULL); @@ -298,7 +298,7 @@ test_port(int controller, int port_type, SignalData *controller_changed) 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); + link = nmtstp_link_get(NM_PLATFORM_GET, ifindex_port, PORT_NAME); g_assert(link); g_assert_cmpint(link->port_data.bond.queue_id, ==, 5); g_assert(link->port_data.bond.prio_has || link->port_data.bond.prio == 0); @@ -309,7 +309,7 @@ test_port(int controller, int port_type, SignalData *controller_changed) const NMPlatformLink *link; const NMPlatformLnkBridge *lnk; - link = nmtstp_link_get_typed(NM_PLATFORM_GET, 0, SLAVE_NAME, NM_LINK_TYPE_DUMMY); + link = nmtstp_link_get_typed(NM_PLATFORM_GET, 0, PORT_NAME, NM_LINK_TYPE_DUMMY); g_assert(link); lnk = nm_platform_link_get_lnk_bridge(NM_PLATFORM_GET, controller, NULL); @@ -329,7 +329,7 @@ test_port(int controller, int port_type, SignalData *controller_changed) 0)); accept_signals(link_changed, 1, 3); - link = nmtstp_link_get(NM_PLATFORM_GET, ifindex_port, SLAVE_NAME); + link = nmtstp_link_get(NM_PLATFORM_GET, ifindex_port, PORT_NAME); g_assert(link); g_assert_cmpint(link->port_data.bridge.path_cost, ==, 100); g_assert_cmpint(link->port_data.bridge.priority, ==, 614); @@ -415,7 +415,7 @@ test_port(int controller, int port_type, SignalData *controller_changed) * Gracefully succeed if already attached port. */ ensure_no_signal(link_changed); - g_assert(nm_platform_link_enslave(NM_PLATFORM_GET, controller, ifindex_port)); + g_assert(nm_platform_link_attach_port(NM_PLATFORM_GET, controller, ifindex_port)); accept_signals(link_changed, 0, 2); accept_signals(controller_changed, 0, 2); @@ -423,8 +423,8 @@ test_port(int controller, int port_type, SignalData *controller_changed) ensure_no_signal(link_added); ensure_no_signal(link_changed); ensure_no_signal(link_removed); - g_assert(nm_platform_link_release(NM_PLATFORM_GET, controller, ifindex_port)); - g_assert_cmpint(nm_platform_link_get_master(NM_PLATFORM_GET, ifindex_port), ==, 0); + g_assert(nm_platform_link_release_port(NM_PLATFORM_GET, controller, ifindex_port)); + g_assert_cmpint(nm_platform_link_get_controller(NM_PLATFORM_GET, ifindex_port), ==, 0); if (link_changed->received_count > 0) { accept_signals(link_added, 0, 1); accept_signals(link_changed, 1, 5); @@ -442,7 +442,7 @@ test_port(int controller, int port_type, SignalData *controller_changed) /* Release again */ ensure_no_signal(link_changed); - g_assert(!nm_platform_link_release(NM_PLATFORM_GET, controller, ifindex_port)); + g_assert(!nm_platform_link_release_port(NM_PLATFORM_GET, controller, ifindex_port)); ensure_no_signal(controller_changed); @@ -517,28 +517,29 @@ test_software(NMLinkType link_type, const char *link_typename) g_assert(nm_platform_link_uses_arp(NM_PLATFORM_GET, ifindex)); accept_signal(link_changed); - /* Set master option */ + /* Set controller option */ if (nmtstp_is_root_test()) { switch (link_type) { case NM_LINK_TYPE_BRIDGE: if (nmtstp_is_sysfs_writable()) { - g_assert(nm_platform_sysctl_master_set_option(NM_PLATFORM_GET, - ifindex, - "forward_delay", - "628")); - value = - nm_platform_sysctl_master_get_option(NM_PLATFORM_GET, ifindex, "forward_delay"); + g_assert(nm_platform_sysctl_controller_set_option(NM_PLATFORM_GET, + ifindex, + "forward_delay", + "628")); + value = nm_platform_sysctl_controller_get_option(NM_PLATFORM_GET, + ifindex, + "forward_delay"); g_assert_cmpstr(value, ==, "628"); g_free(value); } break; case NM_LINK_TYPE_BOND: if (nmtstp_is_sysfs_writable()) { - g_assert(nm_platform_sysctl_master_set_option(NM_PLATFORM_GET, - ifindex, - "mode", - "active-backup")); - value = nm_platform_sysctl_master_get_option(NM_PLATFORM_GET, ifindex, "mode"); + g_assert(nm_platform_sysctl_controller_set_option(NM_PLATFORM_GET, + ifindex, + "mode", + "active-backup")); + value = nm_platform_sysctl_controller_get_option(NM_PLATFORM_GET, ifindex, "mode"); /* When reading back, the output looks slightly different. */ g_assert(g_str_has_prefix(value, "active-backup")); g_free(value); @@ -549,7 +550,7 @@ test_software(NMLinkType link_type, const char *link_typename) } } - /* Enslave and release */ + /* Attach port and release */ switch (link_type) { case NM_LINK_TYPE_BRIDGE: case NM_LINK_TYPE_BOND: @@ -2908,7 +2909,7 @@ test_nl_bugs_spuroius_newlink(void) pllink = nm_platform_link_get(NM_PLATFORM_GET, ifindex_dummy0); g_assert(pllink); g_assert(!nm_platform_link_get_permanent_address(NM_PLATFORM_GET, pllink, &hw_perm_addr)); - if (pllink->master == ifindex_bond0) + if (pllink->controller == ifindex_bond0) break; }); @@ -2965,7 +2966,7 @@ test_nl_bugs_spuroius_dellink(void) pllink = nm_platform_link_get(NM_PLATFORM_GET, ifindex_dummy0); g_assert(pllink); g_assert(!nm_platform_link_get_permanent_address(NM_PLATFORM_GET, pllink, &hw_perm_addr)); - if (pllink->master == ifindex_bridge0) + if (pllink->controller == ifindex_bridge0) break; }); @@ -4064,10 +4065,10 @@ void _nmtstp_setup_tests(void) { nmtstp_link_delete(NM_PLATFORM_GET, -1, -1, DEVICE_NAME, FALSE); - nmtstp_link_delete(NM_PLATFORM_GET, -1, -1, SLAVE_NAME, FALSE); + nmtstp_link_delete(NM_PLATFORM_GET, -1, -1, PORT_NAME, FALSE); nmtstp_link_delete(NM_PLATFORM_GET, -1, -1, PARENT_NAME, FALSE); g_assert(!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, DEVICE_NAME)); - g_assert(!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, SLAVE_NAME)); + g_assert(!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, PORT_NAME)); g_assert(!nm_platform_link_get_by_ifname(NM_PLATFORM_GET, PARENT_NAME)); g_test_add_func("/link/bogus", test_bogus); |