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 | |
| parent | 45a364c60a9d6d34e614c4f1f507c69336ad1e69 (diff) | |
New upstream version 1.48.8 upstream/1.48.8
Diffstat (limited to 'src/core')
44 files changed, 1195 insertions, 1125 deletions
diff --git a/src/core/devices/nm-device-bond.c b/src/core/devices/nm-device-bond.c index 98670c8d..06a02d1a 100644 --- a/src/core/devices/nm-device-bond.c +++ b/src/core/devices/nm-device-bond.c @@ -121,7 +121,7 @@ _set_bond_attr(NMDevice *device, const char *attr, const char *value) /* kernel does not allow setting ad_actor_system to "00:00:00:00:00:00". We would thus * log an EINVAL error. Avoid that... at least, if the value is already "00:00:00:00:00:00". */ cur_val = - nm_platform_sysctl_master_get_option(nm_device_get_platform(device), ifindex, attr); + nm_platform_sysctl_controller_get_option(nm_device_get_platform(device), ifindex, attr); if (nm_streq0(cur_val, NM_BOND_AD_ACTOR_SYSTEM_DEFAULT)) return TRUE; @@ -129,8 +129,10 @@ _set_bond_attr(NMDevice *device, const char *attr, const char *value) * That will fail, and we will log a warning. There is nothing else to do. */ } - ret = - nm_platform_sysctl_master_set_option(nm_device_get_platform(device), ifindex, attr, value); + ret = nm_platform_sysctl_controller_set_option(nm_device_get_platform(device), + ifindex, + attr, + value); if (!ret) _LOGW(LOGD_PLATFORM, "failed to set bonding attribute '%s' to '%s'", attr, value); return ret; @@ -187,8 +189,9 @@ update_connection(NMDevice *device, NMConnection *connection) NM_SETTING_BOND_OPTION_BALANCE_SLB)) continue; - value = - nm_platform_sysctl_master_get_option(nm_device_get_platform(device), ifindex, option); + value = nm_platform_sysctl_controller_get_option(nm_device_get_platform(device), + ifindex, + option); if (value && _nm_setting_bond_get_option_type(s_bond, option) == NM_BOND_OPTION_TYPE_BOTH) { p = strchr(value, ' '); @@ -349,9 +352,10 @@ set_bond_arp_ip_targets(NMDevice *device, NMSettingBond *s_bond) gs_free char *cur_arp_ip_target = NULL; /* ARP targets: clear and initialize the list */ - cur_arp_ip_target = nm_platform_sysctl_master_get_option(nm_device_get_platform(device), - ifindex, - NM_SETTING_BOND_OPTION_ARP_IP_TARGET); + cur_arp_ip_target = + nm_platform_sysctl_controller_get_option(nm_device_get_platform(device), + ifindex, + NM_SETTING_BOND_OPTION_ARP_IP_TARGET); set_arp_targets( device, cur_arp_ip_target, @@ -659,7 +663,7 @@ commit_port_options(NMDevice *bond_device, NMDevice *port, NMSettingBondPort *s_ * one of those modes, don't try to set the priority explicitly to zero. */ prio_has = FALSE; } else if (nm_platform_kernel_support_get_full( - NM_PLATFORM_KERNEL_SUPPORT_TYPE_IFLA_BOND_SLAVE_PRIO, + NM_PLATFORM_KERNEL_SUPPORT_TYPE_IFLA_BOND_PORT_PRIO, FALSE) == NM_OPTION_BOOL_TRUE) { /* We can only detect support if we have it. We cannot detect lack of support if @@ -699,15 +703,15 @@ attach_port(NMDevice *device, NMDeviceBond *self = NM_DEVICE_BOND(device); NMSettingBondPort *s_port; - nm_device_master_check_slave_physical_port(device, port, LOGD_BOND); + nm_device_controller_check_port_physical_port(device, port, LOGD_BOND); if (configure) { gboolean success; nm_device_take_down(port, TRUE); - success = nm_platform_link_enslave(nm_device_get_platform(device), - nm_device_get_ip_ifindex(device), - nm_device_get_ip_ifindex(port)); + success = nm_platform_link_attach_port(nm_device_get_platform(device), + nm_device_get_ip_ifindex(device), + nm_device_get_ip_ifindex(port)); nm_device_bring_up(port); if (!success) { @@ -737,7 +741,7 @@ detach_port(NMDevice *device, NMDeviceBond *self = NM_DEVICE_BOND(device); gboolean success; gs_free char *address = NULL; - int ifindex_slave; + int ifindex_port; int ifindex; if (configure) { @@ -746,9 +750,9 @@ detach_port(NMDevice *device, configure = FALSE; } - ifindex_slave = nm_device_get_ip_ifindex(port); + ifindex_port = nm_device_get_ip_ifindex(port); - if (ifindex_slave <= 0) + if (ifindex_port <= 0) _LOGD(LOGD_BOND, "bond port %s is already detached", nm_device_get_ip_iface(port)); if (configure) { @@ -758,10 +762,10 @@ detach_port(NMDevice *device, address = g_strdup(nm_device_get_hw_address(device)); - if (ifindex_slave > 0) { - success = nm_platform_link_release(nm_device_get_platform(device), - nm_device_get_ip_ifindex(device), - ifindex_slave); + if (ifindex_port > 0) { + success = nm_platform_link_release_port(nm_device_get_platform(device), + nm_device_get_ip_ifindex(device), + ifindex_port); if (success) { _LOGI(LOGD_BOND, "detached bond port %s", nm_device_get_ip_iface(port)); @@ -773,7 +777,7 @@ detach_port(NMDevice *device, if ((applied = nm_device_get_applied_connection(device)) && ((s_wired = nm_connection_get_setting_wired(applied))) && ((cloned_mac = nm_setting_wired_get_cloned_mac_address(s_wired)))) { - /* When the last slave is released the bond MAC will be set to a random + /* When the last port is released the bond MAC will be set to a random * value by kernel; if we have set a cloned-mac-address, we need to * restore it to the previous value. */ nm_platform_process_events(nm_device_get_platform(device)); @@ -781,16 +785,16 @@ detach_port(NMDevice *device, nm_device_hw_addr_set(device, address, "restore", FALSE); } - /* Kernel bonding code "closes" the slave when releasing it, (which clears + /* Kernel bonding code "closes" the port when releasing it, (which clears * IFF_UP), so we must bring it back up here to ensure carrier changes and - * other state is noticed by the now-released slave. + * other state is noticed by the now-released port. */ - if (ifindex_slave > 0) { + if (ifindex_port > 0) { if (!nm_device_bring_up(port)) _LOGW(LOGD_BOND, "detached bond port could not be brought up."); } } else { - if (ifindex_slave > 0) { + if (ifindex_port > 0) { _LOGI(LOGD_BOND, "bond port %s was detached", nm_device_get_ip_iface(port)); } } @@ -962,8 +966,8 @@ nm_device_bond_class_init(NMDeviceBondClass *klass) device_class->get_generic_capabilities = get_generic_capabilities; device_class->complete_connection = complete_connection; - device_class->update_connection = update_connection; - device_class->master_update_slave_connection = controller_update_port_connection; + device_class->update_connection = update_connection; + device_class->controller_update_port_connection = controller_update_port_connection; device_class->create_and_realize = create_and_realize; device_class->act_stage1_prepare = act_stage1_prepare; diff --git a/src/core/devices/nm-device-bridge.c b/src/core/devices/nm-device-bridge.c index 82314f13..b256056d 100644 --- a/src/core/devices/nm-device-bridge.c +++ b/src/core/devices/nm-device-bridge.c @@ -311,7 +311,7 @@ typedef struct { #define OPTION_TYPE_TOFROM(to, fro) .to_sysfs = (to), .from_sysfs = (fro) -static const Option master_options[] = { +static const Option controller_options[] = { OPTION(NM_SETTING_BRIDGE_STP, /* this must stay as the first item */ "stp_state", OPTION_TYPE_BOOL(NM_BRIDGE_STP_DEF), ), @@ -487,12 +487,12 @@ update_connection(NMDevice *device, NMConnection *connection) gs_free char *stp = NULL; int stp_value; - option = master_options; + option = controller_options; nm_assert(nm_streq(option->sysname, "stp_state")); - stp = nm_platform_sysctl_master_get_option(nm_device_get_platform(device), - ifindex, - option->sysname); + stp = nm_platform_sysctl_controller_get_option(nm_device_get_platform(device), + ifindex, + option->sysname); stp_value = _nm_utils_ascii_str_to_int64(stp, 10, option->nm_min, option->nm_max, option->nm_default); g_object_set(s_bridge, option->name, stp_value, NULL); @@ -503,9 +503,9 @@ update_connection(NMDevice *device, NMConnection *connection) gs_free char *str = NULL; GParamSpec *pspec; - str = nm_platform_sysctl_master_get_option(nm_device_get_platform(device), - ifindex, - option->sysname); + str = nm_platform_sysctl_controller_get_option(nm_device_get_platform(device), + ifindex, + option->sysname); pspec = g_object_class_find_property(G_OBJECT_GET_CLASS(s_bridge), option->name); if (!stp_value && option->only_with_stp) @@ -575,22 +575,22 @@ out: } static gboolean -master_update_slave_connection(NMDevice *device, - NMDevice *slave, - NMConnection *connection, - GError **error) +controller_update_port_connection(NMDevice *device, + NMDevice *port, + NMConnection *connection, + GError **error) { NMSettingConnection *s_con; NMSettingBridgePort *s_port; - int ifindex_slave = nm_device_get_ifindex(slave); + int ifindex_port = nm_device_get_ifindex(port); NMConnection *applied_connection = nm_device_get_applied_connection(device); const NMPlatformLink *pllink; - g_return_val_if_fail(ifindex_slave > 0, FALSE); + g_return_val_if_fail(ifindex_port > 0, FALSE); s_con = nm_connection_get_setting_connection(connection); s_port = _nm_connection_ensure_setting(connection, NM_TYPE_SETTING_BRIDGE_PORT); - pllink = nm_platform_link_get(nm_device_get_platform(slave), ifindex_slave); + pllink = nm_platform_link_get(nm_device_get_platform(port), ifindex_port); if (pllink && pllink->port_kind == NM_PORT_KIND_BRIDGE) { g_object_set(s_port, @@ -917,19 +917,19 @@ attach_port(NMDevice *device, gpointer user_data) { NMDeviceBridge *self = NM_DEVICE_BRIDGE(device); - NMConnection *master_connection; + NMConnection *controller_connection; NMSettingBridge *s_bridge; NMSettingBridgePort *s_port; if (configure) { - if (!nm_platform_link_enslave(nm_device_get_platform(device), - nm_device_get_ip_ifindex(device), - nm_device_get_ip_ifindex(port))) + if (!nm_platform_link_attach_port(nm_device_get_platform(device), + nm_device_get_ip_ifindex(device), + nm_device_get_ip_ifindex(port))) return FALSE; - master_connection = nm_device_get_applied_connection(device); - nm_assert(master_connection); - s_bridge = nm_connection_get_setting_bridge(master_connection); + controller_connection = nm_device_get_applied_connection(device); + nm_assert(controller_connection); + s_bridge = nm_connection_get_setting_bridge(controller_connection); nm_assert(s_bridge); s_port = nm_connection_get_setting_bridge_port(connection); @@ -945,7 +945,7 @@ attach_port(NMDevice *device, plat_vlans = setting_vlans_to_platform(vlans); - /* Since the link was just enslaved, there are no existing VLANs + /* Since the link was just enportd, there are no existing VLANs * (except for the default one) and so there's no need to flush. */ if (plat_vlans @@ -976,7 +976,7 @@ detach_port(NMDevice *device, { NMDeviceBridge *self = NM_DEVICE_BRIDGE(device); gboolean success; - int ifindex_slave; + int ifindex_port; int ifindex; if (configure) { @@ -985,17 +985,17 @@ detach_port(NMDevice *device, configure = FALSE; } - ifindex_slave = nm_device_get_ip_ifindex(port); + ifindex_port = nm_device_get_ip_ifindex(port); - if (ifindex_slave <= 0) { + if (ifindex_port <= 0) { _LOGD(LOGD_TEAM, "bridge port %s is already detached", nm_device_get_ip_iface(port)); return TRUE; } if (configure) { - success = nm_platform_link_release(nm_device_get_platform(device), - nm_device_get_ip_ifindex(device), - ifindex_slave); + success = nm_platform_link_release_port(nm_device_get_platform(device), + nm_device_get_ip_ifindex(device), + ifindex_port); if (success) { _LOGI(LOGD_BRIDGE, "detached bridge port %s", nm_device_get_ip_iface(port)); @@ -1061,7 +1061,7 @@ create_and_realize(NMDevice *device, mtu = nm_setting_wired_get_mtu(s_wired); /* If mtu != 0, we set the MTU of the new bridge at creation time. However, kernel will still - * automatically adjust the MTU of the bridge based on the minimum of the slave's MTU. + * automatically adjust the MTU of the bridge based on the minimum of the port's MTU. * We don't want this automatism as the user asked for a fixed MTU. * * To workaround this behavior of kernel, we will later toggle the MTU twice. See @@ -1199,8 +1199,8 @@ nm_device_bridge_class_init(NMDeviceBridgeClass *klass) device_class->check_connection_available = check_connection_available; device_class->complete_connection = complete_connection; - device_class->update_connection = update_connection; - device_class->master_update_slave_connection = master_update_slave_connection; + device_class->update_connection = update_connection; + device_class->controller_update_port_connection = controller_update_port_connection; device_class->create_and_realize = create_and_realize; device_class->act_stage1_prepare_set_hwaddr_ethernet = TRUE; diff --git a/src/core/devices/nm-device-private.h b/src/core/devices/nm-device-private.h index 013bc7fd..3bf5925c 100644 --- a/src/core/devices/nm-device-private.h +++ b/src/core/devices/nm-device-private.h @@ -58,10 +58,11 @@ void nm_device_activate_schedule_stage3_ip_config(NMDevice *device, gboolean do_ void nm_device_recheck_available_connections(NMDevice *device); -void -nm_device_master_check_slave_physical_port(NMDevice *self, NMDevice *slave, NMLogDomain log_domain); +void nm_device_controller_check_port_physical_port(NMDevice *self, + NMDevice *port, + NMLogDomain log_domain); -void nm_device_master_release_slaves_all(NMDevice *self); +void nm_device_controller_release_ports_all(NMDevice *self); void nm_device_set_carrier(NMDevice *self, gboolean carrier); diff --git a/src/core/devices/nm-device-vrf.c b/src/core/devices/nm-device-vrf.c index 6c7adc6c..c3d31347 100644 --- a/src/core/devices/nm-device-vrf.c +++ b/src/core/devices/nm-device-vrf.c @@ -222,13 +222,13 @@ attach_port(NMDevice *device, gboolean success = TRUE; const char *port_iface = nm_device_get_ip_iface(port); - nm_device_master_check_slave_physical_port(device, port, LOGD_DEVICE); + nm_device_controller_check_port_physical_port(device, port, LOGD_DEVICE); if (configure) { nm_device_take_down(port, TRUE); - success = nm_platform_link_enslave(nm_device_get_platform(device), - nm_device_get_ip_ifindex(device), - nm_device_get_ip_ifindex(port)); + success = nm_platform_link_attach_port(nm_device_get_platform(device), + nm_device_get_ip_ifindex(device), + nm_device_get_ip_ifindex(port)); nm_device_bring_up(port); if (!success) @@ -267,9 +267,9 @@ detach_port(NMDevice *device, if (configure) { if (ifindex_port > 0) { - success = nm_platform_link_release(nm_device_get_platform(device), - nm_device_get_ip_ifindex(device), - ifindex_port); + success = nm_platform_link_release_port(nm_device_get_platform(device), + nm_device_get_ip_ifindex(device), + ifindex_port); if (success) { _LOGI(LOGD_DEVICE, "detached VRF port %s", nm_device_get_ip_iface(port)); diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c index f3441508..725241d5 100644 --- a/src/core/devices/nm-device.c +++ b/src/core/devices/nm-device.c @@ -107,10 +107,10 @@ typedef void (*ActivationHandleFunc)(NMDevice *self); typedef enum { - RELEASE_SLAVE_TYPE_NO_CONFIG, - RELEASE_SLAVE_TYPE_CONFIG, - RELEASE_SLAVE_TYPE_CONFIG_FORCE, -} ReleaseSlaveType; + RELEASE_PORT_TYPE_NO_CONFIG, + RELEASE_PORT_TYPE_CONFIG, + RELEASE_PORT_TYPE_CONFIG_FORCE, +} ReleasePortType; typedef enum { CLEANUP_TYPE_KEEP, @@ -127,13 +127,13 @@ typedef enum _nm_packed { } AddrMethodState; typedef struct { - CList lst_slave; - NMDevice *slave; + CList lst_port; + NMDevice *port; GCancellable *cancellable; gulong watch_id; - bool slave_is_enslaved; + bool port_is_attached; bool configure; -} SlaveInfo; +} PortInfo; typedef struct { NMDevice *device; @@ -592,7 +592,7 @@ typedef struct _NMDevicePrivate { NMDeviceAutoconnectBlockedFlags autoconnect_blocked_flags : 5; - bool is_enslaved : 1; + bool is_attached : 1; bool device_link_changed_down : 1; @@ -710,13 +710,13 @@ typedef struct _NMDevicePrivate { NMPlatformLinkChangeFlags flags; } link_props_state; - /* controller interface for bridge/bond/team slave */ + /* controller interface for bridge/bond/team port */ NMDevice *controller; gulong controller_ready_id; int controller_ifindex; - /* slave management */ - CList slaves; /* list of SlaveInfo */ + /* port management */ + CList ports; /* list of PortInfo */ NMMetered metered; @@ -789,11 +789,11 @@ static void _dev_l3_cfg_commit(NMDevice *self, gboolean do_sync); static void _dev_l3_cfg_commit_type_reset(NMDevice *self); -static gboolean nm_device_master_add_slave(NMDevice *self, NMDevice *slave, gboolean configure); -static void nm_device_slave_notify_enslave(NMDevice *self, gboolean success); -static void nm_device_slave_notify_release(NMDevice *self, - NMDeviceStateReason reason, - ReleaseSlaveType release_type); +static gboolean nm_device_controller_add_port(NMDevice *self, NMDevice *port, gboolean configure); +static void nm_device_port_notify_attach_as_port(NMDevice *self, gboolean success); +static void nm_device_port_notify_release(NMDevice *self, + NMDeviceStateReason reason, + ReleasePortType release_type); static void _dev_ipll6_start(NMDevice *self); @@ -3834,9 +3834,9 @@ _dev_ip_state_check(NMDevice *self, int addr_family) if (priv->ip_data_x[IS_IPv4].state == NM_DEVICE_IP_STATE_PENDING && nm_active_connection_get_controller(NM_ACTIVE_CONNECTION(priv->act_request.obj)) - && !priv->is_enslaved) { + && !priv->is_attached) { /* Don't progress into IP_CHECK or SECONDARIES if we're waiting for the - * master to enslave us. */ + * controller to attach as port us. */ ip_state = NM_DEVICE_IP_STATE_PENDING; goto got_ip_state; } @@ -5683,9 +5683,9 @@ nm_device_get_route_metric(NMDevice *self, int addr_family) if (connection) { s_ip = nm_connection_get_setting_ip_config(connection, addr_family); - /* Slave interfaces don't have IP settings, but we may get here when + /* Port interfaces don't have IP settings, but we may get here when * external changes are made or when noticing IP changes when starting - * the slave connection. + * the port connection. */ if (s_ip) { route_metric = nm_setting_ip_config_get_route_metric(s_ip); @@ -6671,43 +6671,43 @@ nm_device_get_connectivity_state(NMDevice *self, int addr_family) /*****************************************************************************/ -static SlaveInfo * -find_slave_info(NMDevice *self, NMDevice *slave) +static PortInfo * +find_port_info(NMDevice *self, NMDevice *port) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); - SlaveInfo *info; + PortInfo *info; - c_list_for_each_entry (info, &priv->slaves, lst_slave) { - if (info->slave == slave) + c_list_for_each_entry (info, &priv->ports, lst_port) { + if (info->port == port) return info; } return NULL; } static void -attach_port_done(NMDevice *self, NMDevice *slave, gboolean success) +attach_port_done(NMDevice *self, NMDevice *port, gboolean success) { - SlaveInfo *info; + PortInfo *info; - info = find_slave_info(self, slave); + info = find_port_info(self, port); if (!info) return; - info->slave_is_enslaved = success; + info->port_is_attached = success; - nm_device_slave_notify_enslave(info->slave, success); + nm_device_port_notify_attach_as_port(info->port, success); /* Ensure the device's hardware address is up-to-date; it often changes - * when slaves change. + * when ports change. */ nm_device_update_hw_address(self); - /* Since slave devices don't have their own IP configuration, + /* Since port devices don't have their own IP configuration, * set the MTU here. */ - _commit_mtu(slave); + _commit_mtu(port); - /* Restart IP configuration if we're waiting for slaves. Do this + /* Restart IP configuration if we're waiting for ports. Do this * after updating the hardware address as IP config may need the * new address. */ @@ -6718,181 +6718,181 @@ attach_port_done(NMDevice *self, NMDevice *slave, gboolean success) static void attach_port_cb(NMDevice *self, GError *error, gpointer user_data) { - NMDevice *slave = user_data; - SlaveInfo *info; + NMDevice *port = user_data; + PortInfo *info; if (nm_utils_error_is_cancelled(error)) return; - info = find_slave_info(self, slave); + info = find_port_info(self, port); if (!info) return; nm_clear_g_cancellable(&info->cancellable); - attach_port_done(self, slave, !error); + attach_port_done(self, port, !error); } /** - * nm_device_master_enslave_slave: - * @self: the master device - * @slave: the slave device to enslave - * @connection: (nullable): the slave device's connection + * nm_device_controller_attach_port: + * @self: the controller device + * @port: the port device to attach as port + * @connection: (nullable): the port device's connection * * If @self is capable of enslaving other devices (ie it's a bridge, bond, team, - * etc) then this function enslaves @slave. + * etc) then this function attach @port. */ static void -nm_device_master_enslave_slave(NMDevice *self, NMDevice *slave, NMConnection *connection) +nm_device_controller_attach_port(NMDevice *self, NMDevice *port, NMConnection *connection) { - SlaveInfo *info; - NMTernary success; - gboolean configure; + PortInfo *info; + NMTernary success; + gboolean configure; g_return_if_fail(self); - g_return_if_fail(slave); + g_return_if_fail(port); g_return_if_fail(NM_DEVICE_GET_CLASS(self)->attach_port); - info = find_slave_info(self, slave); + info = find_port_info(self, port); if (!info) return; - if (info->slave_is_enslaved) + if (info->port_is_attached) success = TRUE; else { configure = (info->configure && connection != NULL); if (configure) - g_return_if_fail(nm_device_get_state(slave) >= NM_DEVICE_STATE_DISCONNECTED); + g_return_if_fail(nm_device_get_state(port) >= NM_DEVICE_STATE_DISCONNECTED); nm_clear_g_cancellable(&info->cancellable); info->cancellable = g_cancellable_new(); success = NM_DEVICE_GET_CLASS(self)->attach_port(self, - slave, + port, connection, configure, info->cancellable, attach_port_cb, - slave); + port); if (success == NM_TERNARY_DEFAULT) return; } - attach_port_done(self, slave, success); + attach_port_done(self, port, success); } static void detach_port_cb(NMDevice *self, GError *error, gpointer user_data) { - nm_auto_unref_object NMDevice *slave = user_data; - NMDevicePrivate *port_priv = NM_DEVICE_GET_PRIVATE(slave); + nm_auto_unref_object NMDevice *port = user_data; + NMDevicePrivate *port_priv = NM_DEVICE_GET_PRIVATE(port); nm_assert(port_priv->port_detach_count > 0); if (--port_priv->port_detach_count == 0) { if (port_priv->state == NM_DEVICE_STATE_DEACTIVATING) { - deactivate_ready(slave, port_priv->port_detach_reason); + deactivate_ready(port, port_priv->port_detach_reason); } } } /** - * nm_device_master_release_slave: - * @self: the master device - * @slave: the slave device to release - * @configure: whether @self needs to actually release @slave - * @release_type: whether @self needs to actually release slave + * nm_device_controller_release_port: + * @self: the controller device + * @port: the port device to release + * @configure: whether @self needs to actually release @port + * @release_type: whether @self needs to actually release port * and whether that is forced. - * @reason: the state change reason for the @slave + * @reason: the state change reason for the @port * * If @self is capable of enslaving other devices (ie it's a bridge, bond, team, - * etc) then this function releases the previously enslaved @slave and/or - * updates the state of @self and @slave to reflect its release. + * etc) then this function releases the previously attached @port and/or + * updates the state of @self and @port to reflect its release. */ static void -nm_device_master_release_slave(NMDevice *self, - NMDevice *slave, - ReleaseSlaveType release_type, - NMDeviceStateReason reason) +nm_device_controller_release_port(NMDevice *self, + NMDevice *port, + ReleasePortType release_type, + NMDeviceStateReason reason) { NMDevicePrivate *priv; NMDevicePrivate *port_priv; - SlaveInfo *info; - gs_unref_object NMDevice *self_free = NULL; - gs_unref_object NMDevice *slave_free = NULL; + PortInfo *info; + gs_unref_object NMDevice *self_free = NULL; + gs_unref_object NMDevice *port_free = NULL; g_return_if_fail(NM_DEVICE(self)); - g_return_if_fail(NM_DEVICE(slave)); + g_return_if_fail(NM_DEVICE(port)); nm_assert(NM_IN_SET(release_type, - RELEASE_SLAVE_TYPE_NO_CONFIG, - RELEASE_SLAVE_TYPE_CONFIG, - RELEASE_SLAVE_TYPE_CONFIG_FORCE)); + RELEASE_PORT_TYPE_NO_CONFIG, + RELEASE_PORT_TYPE_CONFIG, + RELEASE_PORT_TYPE_CONFIG_FORCE)); g_return_if_fail(NM_DEVICE_GET_CLASS(self)->detach_port != NULL); - info = find_slave_info(self, slave); + info = find_port_info(self, port); _LOGT(LOGD_CORE, - "master: release one slave " NM_HASH_OBFUSCATE_PTR_FMT "/%s %s%s", - NM_HASH_OBFUSCATE_PTR(slave), - nm_device_get_iface(slave), - !info ? "(not registered)" : (info->slave_is_enslaved ? "(enslaved)" : "(not enslaved)"), - release_type == RELEASE_SLAVE_TYPE_CONFIG_FORCE + "controller: release one port " NM_HASH_OBFUSCATE_PTR_FMT "/%s %s%s", + NM_HASH_OBFUSCATE_PTR(port), + nm_device_get_iface(port), + !info ? "(not registered)" : (info->port_is_attached ? "(attached)" : "(not attached)"), + release_type == RELEASE_PORT_TYPE_CONFIG_FORCE ? " (force-configure)" - : (release_type == RELEASE_SLAVE_TYPE_CONFIG ? " (configure)" : "(no-config)")); + : (release_type == RELEASE_PORT_TYPE_CONFIG ? " (configure)" : "(no-config)")); if (!info) g_return_if_reached(); priv = NM_DEVICE_GET_PRIVATE(self); - port_priv = NM_DEVICE_GET_PRIVATE(slave); + port_priv = NM_DEVICE_GET_PRIVATE(port); g_return_if_fail(self == port_priv->controller); - nm_assert(slave == info->slave); + nm_assert(port == info->port); nm_clear_g_cancellable(&info->cancellable); /* first, let subclasses handle the release ... */ - if (info->slave_is_enslaved || nm_device_sys_iface_state_is_external(slave) - || release_type >= RELEASE_SLAVE_TYPE_CONFIG_FORCE) { + if (info->port_is_attached || nm_device_sys_iface_state_is_external(port) + || release_type >= RELEASE_PORT_TYPE_CONFIG_FORCE) { NMTernary ret; ret = NM_DEVICE_GET_CLASS(self)->detach_port(self, - slave, - release_type >= RELEASE_SLAVE_TYPE_CONFIG, + port, + release_type >= RELEASE_PORT_TYPE_CONFIG, NULL, detach_port_cb, - g_object_ref(slave)); + g_object_ref(port)); if (ret == NM_TERNARY_DEFAULT) { port_priv->port_detach_count++; port_priv->port_detach_reason = reason; } } - /* raise notifications about the release, including clearing is_enslaved. */ - nm_device_slave_notify_release(slave, reason, release_type); + /* raise notifications about the release, including clearing is_attached. */ + nm_device_port_notify_release(port, reason, release_type); /* keep both alive until the end of the function. * Transfers ownership from port_priv->controller. */ nm_assert(self == port_priv->controller); self_free = g_steal_pointer(&port_priv->controller); - nm_assert(slave == info->slave); - slave_free = g_steal_pointer(&info->slave); + nm_assert(port == info->port); + port_free = g_steal_pointer(&info->port); - c_list_unlink(&info->lst_slave); - g_signal_handler_disconnect(slave, info->watch_id); + c_list_unlink(&info->lst_port); + g_signal_handler_disconnect(port, info->watch_id); nm_g_slice_free(info); - if (c_list_is_empty(&priv->slaves)) { + if (c_list_is_empty(&priv->ports)) { _active_connection_set_state_flags_full(self, 0, - NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES); + NM_ACTIVATION_STATE_FLAG_CONTROLLER_HAS_PORTS); } /* Ensure the device's hardware address is up-to-date; it often changes - * when slaves change. + * when ports change. */ nm_device_update_hw_address(self); - nm_device_set_unmanaged_by_flags(slave, - NM_UNMANAGED_IS_SLAVE, + nm_device_set_unmanaged_by_flags(port, + NM_UNMANAGED_IS_PORT, NM_UNMAN_FLAG_OP_FORGET, NM_DEVICE_STATE_REASON_REMOVED); } @@ -6922,7 +6922,7 @@ _dev_unmanaged_is_external_down(NMDevice *self, gboolean consider_can) /* Manage externally-created software interfaces only when they are IFF_UP */ if (priv->ifindex <= 0 || !priv->up - || !(!c_list_is_empty(&priv->slaves) + || !(!c_list_is_empty(&priv->ports) || nm_platform_link_can_assume(nm_device_get_platform(self), priv->ifindex))) return NM_UNMAN_FLAG_OP_SET_UNMANAGED; @@ -7017,8 +7017,8 @@ carrier_changed(NMDevice *self, gboolean carrier) return; } /* fall-through and change state of device */ - } else if (priv->is_enslaved && !carrier) { - /* Slaves don't deactivate when they lose carrier; for + } else if (priv->is_attached && !carrier) { + /* Ports don't deactivate when they lose carrier; for * bonds/teams in particular that would be actively * counterproductive. */ @@ -7162,65 +7162,65 @@ nm_device_set_carrier_from_platform(NMDevice *self) /*****************************************************************************/ static void -device_recheck_slave_status(NMDevice *self, const NMPlatformLink *plink) +device_recheck_port_status(NMDevice *self, const NMPlatformLink *plink) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); - NMDevice *master; - nm_auto_nmpobj const NMPObject *plink_master_keep_alive = NULL; - const NMPlatformLink *plink_master; + NMDevice *controller; + nm_auto_nmpobj const NMPObject *plink_controller_keep_alive = NULL; + const NMPlatformLink *plink_controller; g_return_if_fail(plink); - if (plink->master > 0) { - master = nm_manager_get_device_by_ifindex(NM_MANAGER_GET, plink->master); - plink_master = nm_platform_link_get(nm_device_get_platform(self), plink->master); - plink_master_keep_alive = nmp_object_ref(NMP_OBJECT_UP_CAST(plink_master)); + if (plink->controller > 0) { + controller = nm_manager_get_device_by_ifindex(NM_MANAGER_GET, plink->controller); + plink_controller = nm_platform_link_get(nm_device_get_platform(self), plink->controller); + plink_controller_keep_alive = nmp_object_ref(NMP_OBJECT_UP_CAST(plink_controller)); } else { if (priv->controller_ifindex == 0) goto out; - master = NULL; - plink_master = NULL; + controller = NULL; + plink_controller = NULL; } - if (master == NULL && plink_master - && NM_IN_STRSET(plink_master->name, "ovs-system", "ovs-netdev") - && plink_master->type == NM_LINK_TYPE_OPENVSWITCH) { + if (controller == NULL && plink_controller + && NM_IN_STRSET(plink_controller->name, "ovs-system", "ovs-netdev") + && plink_controller->type == NM_LINK_TYPE_OPENVSWITCH) { _LOGD(LOGD_DEVICE, "the device claimed by openvswitch"); goto out; } - priv->controller_ifindex = plink->master; + priv->controller_ifindex = plink->controller; if (priv->controller) { - if (plink->master > 0 && plink->master == nm_device_get_ifindex(priv->controller)) { - /* call add-slave again. We expect @self already to be added to - * the master, but this also triggers a recheck-assume. */ - nm_device_master_add_slave(priv->controller, self, FALSE); + if (plink->controller > 0 && plink->controller == nm_device_get_ifindex(priv->controller)) { + /* call add-port again. We expect @self already to be added to + * the controller, but this also triggers a recheck-assume. */ + nm_device_controller_add_port(priv->controller, self, FALSE); goto out; } - nm_device_master_release_slave(priv->controller, - self, - RELEASE_SLAVE_TYPE_NO_CONFIG, - NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); + nm_device_controller_release_port(priv->controller, + self, + RELEASE_PORT_TYPE_NO_CONFIG, + NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); } - if (master) { - if (NM_DEVICE_GET_CLASS(master)->attach_port) { - nm_device_master_add_slave(master, self, FALSE); + if (controller) { + if (NM_DEVICE_GET_CLASS(controller)->attach_port) { + nm_device_controller_add_port(controller, self, FALSE); } else { _LOGD(LOGD_DEVICE, - "enslaved to non-master-type device %s; ignoring", - nm_device_get_iface(master)); + "attached to non-controller-type device %s; ignoring", + nm_device_get_iface(controller)); } goto out; } - if (plink->master) { + if (plink->controller) { _LOGD(LOGD_DEVICE, - "enslaved to unknown device %d (%s%s%s)", - plink->master, - NM_PRINT_FMT_QUOTED(plink_master, "\"", plink_master->name, "\"", "??")); + "attached to unknown device %d (%s%s%s)", + plink->controller, + NM_PRINT_FMT_QUOTED(plink_controller, "\"", plink_controller->name, "\"", "??")); if (!priv->ifindex_changed_id) { priv->ifindex_changed_id = g_signal_connect(nm_device_get_manager(self), NM_MANAGER_DEVICE_IFINDEX_CHANGED, @@ -7246,7 +7246,7 @@ device_ifindex_changed_cb(NMManager *manager, NMDevice *device_changed, NMDevice return; _LOGD(LOGD_DEVICE, - "master %s with ifindex %d appeared", + "controller %s with ifindex %d appeared", nm_device_get_iface(device_changed), nm_device_get_ifindex(device_changed)); if (!priv->device_link_changed_id) @@ -7436,7 +7436,7 @@ device_link_changed(gpointer user_data) _dev_unmanaged_check_external_down(self, FALSE, FALSE); - device_recheck_slave_status(self, pllink); + device_recheck_port_status(self, pllink); if (priv->up && (!was_up || seen_down)) { /* the link was down and just came up. That happens for example, while changing MTU. @@ -7988,7 +7988,7 @@ realize_start_notify(NMDevice *self, const NMPlatformLink *pllink) * Update the device from backing resource properties (like hardware * addresses, carrier states, driver/firmware info, etc). This function * should only change properties for this device, and should not perform - * any tasks that affect other interfaces (like master/slave or parent/child + * any tasks that affect other interfaces (like controller/port or parent/child * stuff). */ static void @@ -8140,7 +8140,7 @@ realize_start_setup(NMDevice *self, * @self: the #NMDevice * @plink: the #NMPlatformLink if backed by a kernel netdevice * - * Update the device's master/slave or parent/child relationships from + * Update the device's controller/port or parent/child relationships from * backing resource properties. After this function finishes, the device * is ready for network connectivity. */ @@ -8157,7 +8157,7 @@ nm_device_realize_finish(NMDevice *self, const NMPlatformLink *plink) g_return_if_fail(!priv->real); if (plink) - device_recheck_slave_status(self, plink); + device_recheck_port_status(self, plink); priv->real = TRUE; _notify(self, PROP_REAL); @@ -8317,7 +8317,7 @@ nm_device_unrealize(NMDevice *self, gboolean remove_resources, GError **error) nm_device_set_unmanaged_flags(self, NM_UNMANAGED_USER_UDEV | NM_UNMANAGED_USER_EXPLICIT - | NM_UNMANAGED_EXTERNAL_DOWN | NM_UNMANAGED_IS_SLAVE, + | NM_UNMANAGED_EXTERNAL_DOWN | NM_UNMANAGED_IS_PORT, NM_UNMAN_FLAG_OP_FORGET); nm_device_state_changed(self, @@ -8436,117 +8436,117 @@ nm_device_new_default_connection(NMDevice *self) } static void -slave_state_changed(NMDevice *slave, - NMDeviceState slave_new_state, - NMDeviceState slave_old_state, - NMDeviceStateReason reason, - NMDevice *self) +port_state_changed(NMDevice *port, + NMDeviceState port_new_state, + NMDeviceState port_old_state, + NMDeviceStateReason reason, + NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); gboolean release = FALSE; gboolean configure; _LOGD(LOGD_DEVICE, - "slave %s state change %d (%s) -> %d (%s)", - nm_device_get_iface(slave), - slave_old_state, - nm_device_state_to_string(slave_old_state), - slave_new_state, - nm_device_state_to_string(slave_new_state)); - - /* Don't try to enslave slaves until the master is ready */ + "port %s state change %d (%s) -> %d (%s)", + nm_device_get_iface(port), + port_old_state, + nm_device_state_to_string(port_old_state), + port_new_state, + nm_device_state_to_string(port_new_state)); + + /* Don't try to attach ports until the controller is ready */ if (priv->state < NM_DEVICE_STATE_CONFIG) return; - if (slave_new_state == NM_DEVICE_STATE_IP_CONFIG) - nm_device_master_enslave_slave(self, slave, nm_device_get_applied_connection(slave)); - else if (slave_new_state > NM_DEVICE_STATE_ACTIVATED) + if (port_new_state == NM_DEVICE_STATE_IP_CONFIG) + nm_device_controller_attach_port(self, port, nm_device_get_applied_connection(port)); + else if (port_new_state > NM_DEVICE_STATE_ACTIVATED) release = TRUE; - else if (slave_new_state <= NM_DEVICE_STATE_DISCONNECTED - && slave_old_state > NM_DEVICE_STATE_DISCONNECTED) { + else if (port_new_state <= NM_DEVICE_STATE_DISCONNECTED + && port_old_state > NM_DEVICE_STATE_DISCONNECTED) { /* Catch failures due to unavailable or unmanaged */ release = TRUE; } if (release) { configure = (priv->sys_iface_state == NM_DEVICE_SYS_IFACE_STATE_MANAGED - && nm_device_sys_iface_state_get(slave) != NM_DEVICE_SYS_IFACE_STATE_EXTERNAL) - || nm_device_sys_iface_state_get(slave) == NM_DEVICE_SYS_IFACE_STATE_MANAGED; - - nm_device_master_release_slave(self, - slave, - configure ? RELEASE_SLAVE_TYPE_CONFIG - : RELEASE_SLAVE_TYPE_NO_CONFIG, - reason); + && nm_device_sys_iface_state_get(port) != NM_DEVICE_SYS_IFACE_STATE_EXTERNAL) + || nm_device_sys_iface_state_get(port) == NM_DEVICE_SYS_IFACE_STATE_MANAGED; + + nm_device_controller_release_port(self, + port, + configure ? RELEASE_PORT_TYPE_CONFIG + : RELEASE_PORT_TYPE_NO_CONFIG, + reason); /* Bridge/bond/team interfaces are left up until manually deactivated */ - if (c_list_is_empty(&priv->slaves) && priv->state == NM_DEVICE_STATE_ACTIVATED) - _LOGD(LOGD_DEVICE, "last slave removed; remaining activated"); + if (c_list_is_empty(&priv->ports) && priv->state == NM_DEVICE_STATE_ACTIVATED) + _LOGD(LOGD_DEVICE, "last port removed; remaining activated"); } } /** - * nm_device_master_add_slave: - * @self: the master device - * @slave: the slave device to enslave - * @configure: pass %TRUE if the slave should be configured by the master, or + * nm_device_controller_add_port: + * @self: the controller device + * @port: the port device to attach as port + * @configure: pass %TRUE if the port should be configured by the controller, or * %FALSE if it is already configured outside NetworkManager * * If @self is capable of enslaving other devices (ie it's a bridge, bond, team, - * etc) then this function adds @slave to the slave list for later enslavement. + * etc) then this function adds @port to the port list for later attachment as port. * - * Returns: %TRUE if the slave was enslaved. %FALSE means, the slave was already - * enslaved and nothing was done. + * Returns: %TRUE if the port was attached. %FALSE means, the port was already + * attached and nothing was done. */ static gboolean -nm_device_master_add_slave(NMDevice *self, NMDevice *slave, gboolean configure) +nm_device_controller_add_port(NMDevice *self, NMDevice *port, gboolean configure) { NMDevicePrivate *priv; NMDevicePrivate *port_priv; - SlaveInfo *info; + PortInfo *info; gboolean changed = FALSE; g_return_val_if_fail(NM_IS_DEVICE(self), FALSE); - g_return_val_if_fail(NM_IS_DEVICE(slave), FALSE); + g_return_val_if_fail(NM_IS_DEVICE(port), FALSE); g_return_val_if_fail(NM_DEVICE_GET_CLASS(self)->attach_port, FALSE); priv = NM_DEVICE_GET_PRIVATE(self); - port_priv = NM_DEVICE_GET_PRIVATE(slave); + port_priv = NM_DEVICE_GET_PRIVATE(port); - info = find_slave_info(self, slave); + info = find_port_info(self, port); _LOGT(LOGD_CORE, - "master: add one slave " NM_HASH_OBFUSCATE_PTR_FMT "/%s%s", - NM_HASH_OBFUSCATE_PTR(slave), - nm_device_get_iface(slave), + "controller: add one port " NM_HASH_OBFUSCATE_PTR_FMT "/%s%s", + NM_HASH_OBFUSCATE_PTR(port), + nm_device_get_iface(port), info ? " (already registered)" : ""); if (configure) - g_return_val_if_fail(nm_device_get_state(slave) >= NM_DEVICE_STATE_DISCONNECTED, FALSE); + g_return_val_if_fail(nm_device_get_state(port) >= NM_DEVICE_STATE_DISCONNECTED, FALSE); if (!info) { g_return_val_if_fail(!port_priv->controller, FALSE); - g_return_val_if_fail(!port_priv->is_enslaved, FALSE); + g_return_val_if_fail(!port_priv->is_attached, FALSE); - info = g_slice_new0(SlaveInfo); - info->slave = g_object_ref(slave); + info = g_slice_new0(PortInfo); + info->port = g_object_ref(port); info->configure = configure; info->watch_id = - g_signal_connect(slave, NM_DEVICE_STATE_CHANGED, G_CALLBACK(slave_state_changed), self); - c_list_link_tail(&priv->slaves, &info->lst_slave); + g_signal_connect(port, NM_DEVICE_STATE_CHANGED, G_CALLBACK(port_state_changed), self); + c_list_link_tail(&priv->ports, &info->lst_port); port_priv->controller = g_object_ref(self); - _active_connection_set_state_flags(self, NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES); + _active_connection_set_state_flags(self, NM_ACTIVATION_STATE_FLAG_CONTROLLER_HAS_PORTS); /* no need to emit * - * _notify (slave, PROP_CONTROLLER); + * _notify (port, PROP_CONTROLLER); * - * because port_priv->is_enslaved is not true, thus the value + * because port_priv->is_attached is not true, thus the value * didn't change yet. */ - g_warn_if_fail(!NM_FLAGS_HAS(port_priv->unmanaged_mask, NM_UNMANAGED_IS_SLAVE)); - nm_device_set_unmanaged_by_flags(slave, - NM_UNMANAGED_IS_SLAVE, + g_warn_if_fail(!NM_FLAGS_HAS(port_priv->unmanaged_mask, NM_UNMANAGED_IS_PORT)); + nm_device_set_unmanaged_by_flags(port, + NM_UNMANAGED_IS_PORT, NM_UNMAN_FLAG_OP_SET_MANAGED, NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); changed = TRUE; @@ -8554,42 +8554,44 @@ nm_device_master_add_slave(NMDevice *self, NMDevice *slave, gboolean configure) g_return_val_if_fail(port_priv->controller == self, FALSE); nm_device_queue_recheck_assume(self); - nm_device_queue_recheck_assume(slave); + nm_device_queue_recheck_assume(port); return changed; } /** - * nm_device_master_check_slave_physical_port: - * @self: the master device - * @slave: a slave device + * nm_device_controller_check_port_physical_port: + * @self: the controller device + * @port: a port device * @log_domain: domain to log a warning in * - * Checks if @self already has a slave with the same #NMDevice:physical-port-id - * as @slave, and logs a warning if so. + * Checks if @self already has a port with the same #NMDevice:physical-port-id + * as @port, and logs a warning if so. */ void -nm_device_master_check_slave_physical_port(NMDevice *self, NMDevice *slave, NMLogDomain log_domain) +nm_device_controller_check_port_physical_port(NMDevice *self, + NMDevice *port, + NMLogDomain log_domain) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); - const char *slave_physical_port_id, *existing_physical_port_id; - SlaveInfo *info; + const char *port_physical_port_id, *existing_physical_port_id; + PortInfo *info; - slave_physical_port_id = nm_device_get_physical_port_id(slave); - if (!slave_physical_port_id) + port_physical_port_id = nm_device_get_physical_port_id(port); + if (!port_physical_port_id) return; - c_list_for_each_entry (info, &priv->slaves, lst_slave) { - if (info->slave == slave) + c_list_for_each_entry (info, &priv->ports, lst_port) { + if (info->port == port) continue; - existing_physical_port_id = nm_device_get_physical_port_id(info->slave); - if (nm_streq0(slave_physical_port_id, existing_physical_port_id)) { + existing_physical_port_id = nm_device_get_physical_port_id(info->port); + if (nm_streq0(port_physical_port_id, existing_physical_port_id)) { _LOGW(log_domain, - "slave %s shares a physical port with existing slave %s", - nm_device_get_ip_iface(slave), - nm_device_get_ip_iface(info->slave)); - /* Since this function will get called for every slave, we only have + "port %s shares a physical port with existing port %s", + nm_device_get_ip_iface(port), + nm_device_get_ip_iface(info->port)); + /* Since this function will get called for every port, we only have * to warn about the first match we find; if there are other matches * later in the list, we will have already warned about them matching * @existing earlier. @@ -8600,14 +8602,14 @@ nm_device_master_check_slave_physical_port(NMDevice *self, NMDevice *slave, NMLo } void -nm_device_master_release_slaves_all(NMDevice *self) +nm_device_controller_release_ports_all(NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); NMDeviceStateReason reason; - SlaveInfo *info; - SlaveInfo *safe; + PortInfo *info; + PortInfo *safe; - /* Don't release the slaves if this connection doesn't belong to NM. */ + /* Don't release the ports if this connection doesn't belong to NM. */ if (nm_device_sys_iface_state_is_external(self)) return; @@ -8615,15 +8617,15 @@ nm_device_master_release_slaves_all(NMDevice *self) if (priv->state == NM_DEVICE_STATE_FAILED) reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; - c_list_for_each_entry_safe (info, safe, &priv->slaves, lst_slave) { + c_list_for_each_entry_safe (info, safe, &priv->ports, lst_port) { if (priv->activation_state_preserve_external_ports - && nm_device_sys_iface_state_is_external(info->slave)) { + && nm_device_sys_iface_state_is_external(info->port)) { _LOGT(LOGD_DEVICE, - "master: preserve external port %s", - nm_device_get_iface(info->slave)); + "controller: preserve external port %s", + nm_device_get_iface(info->port)); continue; } - nm_device_master_release_slave(self, info->slave, RELEASE_SLAVE_TYPE_CONFIG, reason); + nm_device_controller_release_port(self, info->port, RELEASE_PORT_TYPE_CONFIG, reason); } /* We only need this flag for a short time. It served its purpose. Clear @@ -8663,7 +8665,7 @@ nm_device_get_controller(NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); - if (priv->is_enslaved) { + if (priv->is_attached) { g_return_val_if_fail(priv->controller, NULL); return priv->controller; } @@ -8671,15 +8673,15 @@ nm_device_get_controller(NMDevice *self) } /** - * nm_device_slave_notify_enslave: - * @self: the slave device + * nm_device_port_notify_attach: + * @self: the port device * @success: whether the enslaving operation succeeded * - * Notifies a slave that either it has been enslaved, or else its master tried - * to enslave it and failed. + * Notifies a port that either it has been attached, or else its controller tried + * to attach it as port and failed. */ static void -nm_device_slave_notify_enslave(NMDevice *self, gboolean success) +nm_device_port_notify_attach_as_port(NMDevice *self, gboolean success) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); NMConnection *connection = nm_device_get_applied_connection(self); @@ -8687,16 +8689,16 @@ nm_device_slave_notify_enslave(NMDevice *self, gboolean success) g_return_if_fail(priv->controller); - if (!priv->is_enslaved) { + if (!priv->is_attached) { if (success) { if (activating) { _LOGI(LOGD_DEVICE, - "Activation: connection '%s' enslaved, continuing activation", + "Activation: connection '%s' attached as port, continuing activation", nm_connection_get_id(connection)); } else - _LOGI(LOGD_DEVICE, "enslaved to %s", nm_device_get_iface(priv->controller)); + _LOGI(LOGD_DEVICE, "attached to %s", nm_device_get_iface(priv->controller)); - priv->is_enslaved = TRUE; + priv->is_attached = TRUE; _notify(priv->controller, PROP_CONTROLLER); @@ -8705,7 +8707,7 @@ nm_device_slave_notify_enslave(NMDevice *self, gboolean success) nm_gobject_notify_together(priv->controller, PROP_PORTS, PROP_SLAVES); } else if (activating) { _LOGW(LOGD_DEVICE, - "Activation: connection '%s' could not be enslaved", + "Activation: connection '%s' could not be attached as port", nm_connection_get_id(connection)); } } @@ -8724,56 +8726,58 @@ nm_device_slave_notify_enslave(NMDevice *self, gboolean success) } /** - * nm_device_slave_notify_release: - * @self: the slave device + * nm_device_port_notify_release: + * @self: the port device * @reason: the reason associated with the state change * - * Notifies a slave that it has been released, and why. + * Notifies a port that it has been released, and why. */ static void -nm_device_slave_notify_release(NMDevice *self, - NMDeviceStateReason reason, - ReleaseSlaveType release_type) +nm_device_port_notify_release(NMDevice *self, + NMDeviceStateReason reason, + ReleasePortType release_type) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); NMConnection *connection = nm_device_get_applied_connection(self); - const char *master_status; + const char *controller_status; g_return_if_fail(priv->controller); - if (!priv->is_enslaved && release_type == RELEASE_SLAVE_TYPE_NO_CONFIG) + if (!priv->is_attached && release_type == RELEASE_PORT_TYPE_NO_CONFIG) return; if (priv->state > NM_DEVICE_STATE_DISCONNECTED && priv->state <= NM_DEVICE_STATE_ACTIVATED) { switch (nm_device_state_reason_check(reason)) { case NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED: - master_status = "failed"; + controller_status = "failed"; break; case NM_DEVICE_STATE_REASON_USER_REQUESTED: - reason = NM_DEVICE_STATE_REASON_USER_REQUESTED; - master_status = "deactivated by user request"; + reason = NM_DEVICE_STATE_REASON_USER_REQUESTED; + controller_status = "deactivated by user request"; break; case NM_DEVICE_STATE_REASON_CONNECTION_REMOVED: - reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; - master_status = "deactivated because master was removed"; + reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; + controller_status = "deactivated because controller was removed"; break; default: - master_status = "deactivated"; + controller_status = "deactivated"; break; } _LOGD(LOGD_DEVICE, - "Activation: connection '%s' master %s", + "Activation: connection '%s' controller %s", nm_connection_get_id(connection), - master_status); + controller_status); /* Cancel any pending activation sources */ _cancel_activation(self); nm_device_queue_state(self, NM_DEVICE_STATE_DEACTIVATING, reason); } else - _LOGI(LOGD_DEVICE, "released from master device %s", nm_device_get_iface(priv->controller)); + _LOGI(LOGD_DEVICE, + "released from controller device %s", + nm_device_get_iface(priv->controller)); - priv->is_enslaved = FALSE; + priv->is_attached = FALSE; _notify(priv->controller, PROP_CONTROLLER); @@ -8788,7 +8792,7 @@ nm_device_slave_notify_release(NMDevice *self, * of the device (provided, it is still not cleared at this point). * * Called by the manager when the device was removed. Releases the device from - * the master in case it's enslaved. + * the controller in case it's attached as port. */ void nm_device_removed(NMDevice *self, gboolean unconfigure_ip_config) @@ -8803,12 +8807,12 @@ nm_device_removed(NMDevice *self, gboolean unconfigure_ip_config) priv = NM_DEVICE_GET_PRIVATE(self); if (priv->controller) { - /* this is called when something externally messes with the slave or during shut-down. - * Release the slave from master, but don't touch the device. */ - nm_device_master_release_slave(priv->controller, - self, - RELEASE_SLAVE_TYPE_NO_CONFIG, - NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); + /* this is called when something externally messes with the port or during shut-down. + * Release the port from controller, but don't touch the device. */ + nm_device_controller_release_port(priv->controller, + self, + RELEASE_PORT_TYPE_NO_CONFIG, + NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); } _dev_l3_register_l3cds(self, priv->l3cfg, FALSE, unconfigure_ip_config); @@ -8837,7 +8841,7 @@ is_available(NMDevice *self, NMDeviceCheckDevAvailableFlags flags) if (NM_FLAGS_HAS(flags, _NM_DEVICE_CHECK_DEV_AVAILABLE_IGNORE_CARRIER)) return TRUE; - /* master types are always available even without carrier. */ + /* controller types are always available even without carrier. */ if (nm_device_is_controller(self)) return TRUE; @@ -8877,7 +8881,7 @@ nm_device_is_available(NMDevice *self, NMDeviceCheckDevAvailableFlags flags) gboolean nm_device_ignore_carrier_by_default(NMDevice *self) { - /* master types ignore-carrier by default. */ + /* controller types ignore-carrier by default. */ return nm_device_is_controller(self); } @@ -9090,8 +9094,8 @@ device_has_config(NMDevice *self) if (!pllink) return FALSE; - if (pllink->master > 0) { - /* Master-slave relationship is also a configuration */ + if (pllink->controller > 0) { + /* Master-port relationship is also a configuration */ return TRUE; } @@ -9116,30 +9120,30 @@ device_has_config(NMDevice *self) } /** - * nm_device_master_update_slave_connection: - * @self: the master #NMDevice - * @slave: the slave #NMDevice - * @connection: the #NMConnection to update with the slave settings + * nm_device_controller_update_port_connection: + * @self: the controller #NMDevice + * @port: the port #NMDevice + * @connection: the #NMConnection to update with the port settings * @error: error description * - * Reads the slave configuration for @slave and updates @connection with those - * properties. This invokes a virtual function on the master device @self. + * Reads the port configuration for @port and updates @connection with those + * properties. This invokes a virtual function on the controller device @self. * * Returns: %TRUE if the configuration was read and @connection updated, * %FALSE on failure. */ gboolean -nm_device_master_update_slave_connection(NMDevice *self, - NMDevice *slave, - NMConnection *connection, - GError **error) +nm_device_controller_update_port_connection(NMDevice *self, + NMDevice *port, + NMConnection *connection, + GError **error) { NMDeviceClass *klass; gboolean success; g_return_val_if_fail(self, FALSE); g_return_val_if_fail(NM_IS_DEVICE(self), FALSE); - g_return_val_if_fail(slave, FALSE); + g_return_val_if_fail(port, FALSE); g_return_val_if_fail(connection, FALSE); g_return_val_if_fail(!error || !*error, FALSE); g_return_val_if_fail(nm_connection_get_setting_connection(connection), FALSE); @@ -9147,20 +9151,21 @@ nm_device_master_update_slave_connection(NMDevice *self, g_return_val_if_fail(nm_device_get_iface(self), FALSE); klass = NM_DEVICE_GET_CLASS(self); - if (klass->master_update_slave_connection) { - success = klass->master_update_slave_connection(self, slave, connection, error); + if (klass->controller_update_port_connection) { + success = klass->controller_update_port_connection(self, port, connection, error); g_return_val_if_fail(!error || (success && !*error) || *error, success); return success; } - g_set_error(error, - NM_DEVICE_ERROR, - NM_DEVICE_ERROR_FAILED, - "master device '%s' cannot update a slave connection for slave device '%s' (master " - "type not supported?)", - nm_device_get_iface(self), - nm_device_get_iface(slave)); + g_set_error( + error, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_FAILED, + "controller device '%s' cannot update a port connection for port device '%s' (controller " + "type not supported?)", + nm_device_get_iface(self), + nm_device_get_iface(port)); return FALSE; } @@ -9196,7 +9201,7 @@ _get_maybe_ipv6_disabled(NMDevice *self) */ NMConnection * nm_device_generate_connection(NMDevice *self, - NMDevice *master, + NMDevice *controller, gboolean *out_maybe_later, GError **error) { @@ -9254,21 +9259,21 @@ nm_device_generate_connection(NMDevice *self, nm_connection_add_setting(connection, s_con); - /* If the device is a slave, update various slave settings */ - if (master) { - if (!nm_device_master_update_slave_connection(master, self, connection, &local)) { + /* If the device is a port, update various port settings */ + if (controller) { + if (!nm_device_controller_update_port_connection(controller, self, connection, &local)) { g_set_error(error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, - "master device '%s' failed to update slave connection: %s", - nm_device_get_iface(master), + "controller device '%s' failed to update port connection: %s", + nm_device_get_iface(controller), local->message); g_error_free(local); NM_SET_OUT(out_maybe_later, TRUE); return NULL; } } else { - /* Only regular and master devices get IP configuration; slaves do not */ + /* Only regular and controller devices get IP configuration; ports do not */ s_ip4 = nm_utils_platform_capture_ip_setting(nm_device_get_platform(self), AF_INET, nm_device_get_ip_ifindex(self), @@ -9309,7 +9314,7 @@ nm_device_generate_connection(NMDevice *self, } /* Ignore the connection if it has no IP configuration, - * no slave configuration, and is not a master interface. + * no port configuration, and is not a controller interface. */ ip4_method = nm_utils_get_ip_config_method(connection, AF_INET); ip6_method = nm_utils_get_ip_config_method(connection, AF_INET6); @@ -9318,32 +9323,33 @@ nm_device_generate_connection(NMDevice *self, NM_SETTING_IP6_CONFIG_METHOD_IGNORE, NM_SETTING_IP6_CONFIG_METHOD_DISABLED) && !nm_setting_connection_get_controller(NM_SETTING_CONNECTION(s_con)) - && c_list_is_empty(&priv->slaves)) { + && c_list_is_empty(&priv->ports)) { NM_SET_OUT(out_maybe_later, TRUE); g_set_error_literal( error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, - "ignoring generated connection (no IP and not in master-slave relationship)"); + "ignoring generated connection (no IP and not in controller-port relationship)"); return NULL; } - /* Ignore any IPv6LL-only, not master connections without slaves, + /* Ignore any IPv6LL-only, not controller connections without ports, * unless they are in the assume-ipv6ll-only list. */ if (nm_streq0(ip4_method, NM_SETTING_IP4_CONFIG_METHOD_DISABLED) && nm_streq0(ip6_method, NM_SETTING_IP6_CONFIG_METHOD_LINK_LOCAL) && !nm_setting_connection_get_controller(NM_SETTING_CONNECTION(s_con)) - && c_list_is_empty(&priv->slaves) + && c_list_is_empty(&priv->ports) && !nm_config_data_get_assume_ipv6ll_only(NM_CONFIG_GET_DATA, self)) { - _LOGD(LOGD_DEVICE, - "ignoring generated connection (IPv6LL-only and not in master-slave relationship)"); + _LOGD( + LOGD_DEVICE, + "ignoring generated connection (IPv6LL-only and not in controller-port relationship)"); NM_SET_OUT(out_maybe_later, TRUE); g_set_error_literal( error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, - "ignoring generated connection (IPv6LL-only and not in master-slave relationship)"); + "ignoring generated connection (IPv6LL-only and not in controller-port relationship)"); return NULL; } @@ -9594,28 +9600,28 @@ nm_device_check_connection_compatible(NMDevice *self, } gboolean -nm_device_check_slave_connection_compatible(NMDevice *self, NMConnection *slave) +nm_device_check_port_connection_compatible(NMDevice *self, NMConnection *port) { NMSettingConnection *s_con; - const char *connection_type, *slave_type; + const char *connection_type, *port_type; g_return_val_if_fail(NM_IS_DEVICE(self), FALSE); - g_return_val_if_fail(NM_IS_CONNECTION(slave), FALSE); + g_return_val_if_fail(NM_IS_CONNECTION(port), FALSE); if (!nm_device_is_controller(self)) return FALSE; - /* All masters should have connection type set */ + /* All controllers should have connection type set */ connection_type = NM_DEVICE_GET_CLASS(self)->connection_type_supported; g_return_val_if_fail(connection_type, FALSE); - s_con = nm_connection_get_setting_connection(slave); + s_con = nm_connection_get_setting_connection(port); g_assert(s_con); - slave_type = nm_setting_connection_get_port_type(s_con); - if (!slave_type) + port_type = nm_setting_connection_get_port_type(s_con); + if (!port_type) return FALSE; - return nm_streq(connection_type, slave_type); + return nm_streq(connection_type, port_type); } gboolean @@ -9905,35 +9911,37 @@ activation_source_invoke_or_schedule(NMDevice *self, ActivationHandleFunc func, /*****************************************************************************/ static void -master_ready(NMDevice *self, NMActiveConnection *active) +controller_ready(NMDevice *self, NMActiveConnection *active) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); - NMActiveConnection *master_connection; - NMDevice *master; + NMActiveConnection *controller_connection; + NMDevice *controller; /* Notify a controller device that it has a new port */ nm_assert(nm_active_connection_get_controller_ready(active)); - master_connection = nm_active_connection_get_controller(active); + controller_connection = nm_active_connection_get_controller(active); - master = nm_active_connection_get_device(master_connection); + controller = nm_active_connection_get_device(controller_connection); - _LOGD(LOGD_DEVICE, "master connection ready; master device %s", nm_device_get_iface(master)); + _LOGD(LOGD_DEVICE, + "controller connection ready; controller device %s", + nm_device_get_iface(controller)); - if (priv->controller && priv->controller != master) - nm_device_master_release_slave(priv->controller, - self, - RELEASE_SLAVE_TYPE_NO_CONFIG, - NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); + if (priv->controller && priv->controller != controller) + nm_device_controller_release_port(priv->controller, + self, + RELEASE_PORT_TYPE_NO_CONFIG, + NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); - /* If the master didn't change, add-slave only rechecks whether to assume a connection. */ - nm_device_master_add_slave(master, - self, - !nm_device_sys_iface_state_is_external_or_assume(self)); + /* If the controller didn't change, add-port only rechecks whether to assume a connection. */ + nm_device_controller_add_port(controller, + self, + !nm_device_sys_iface_state_is_external_or_assume(self)); } static void -master_ready_cb(NMActiveConnection *active, GParamSpec *pspec, NMDevice *self) +controller_ready_cb(NMActiveConnection *active, GParamSpec *pspec, NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); @@ -10062,7 +10070,7 @@ activate_stage1_device_prepare(NMDevice *self) NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); NMActStageReturn ret = NM_ACT_STAGE_RETURN_SUCCESS; NMActiveConnection *active; - NMActiveConnection *master; + NMActiveConnection *controller; NMDeviceClass *klass; nm_assert((priv->ip_data_4.state == NM_DEVICE_IP_STATE_NONE) @@ -10183,16 +10191,16 @@ activate_stage1_device_prepare(NMDevice *self) } } - active = NM_ACTIVE_CONNECTION(priv->act_request.obj); - master = nm_active_connection_get_controller(active); - if (master) { - if (nm_active_connection_get_state(master) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { - NMDevice *master_device = nm_active_connection_get_device(master); - NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; + active = NM_ACTIVE_CONNECTION(priv->act_request.obj); + controller = nm_active_connection_get_controller(active); + if (controller) { + if (nm_active_connection_get_state(controller) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { + NMDevice *controller_device = nm_active_connection_get_device(controller); + NMDeviceStateReason failure_reason = NM_DEVICE_STATE_REASON_DEPENDENCY_FAILED; - _LOGD(LOGD_DEVICE, "master connection is deactivating"); + _LOGD(LOGD_DEVICE, "controller connection is deactivating"); - if (master_device && NM_DEVICE_GET_PRIVATE(master_device)->queued_act_request) { + if (controller_device && NM_DEVICE_GET_PRIVATE(controller_device)->queued_act_request) { /* if the controller is going to activate again, don't block this device */ failure_reason = NM_DEVICE_STATE_REASON_NONE; } @@ -10206,20 +10214,20 @@ activate_stage1_device_prepare(NMDevice *self) priv->controller_ready_id = g_signal_connect(active, "notify::" NM_ACTIVE_CONNECTION_INT_CONTROLLER_READY, - G_CALLBACK(master_ready_cb), + G_CALLBACK(controller_ready_cb), self); } return; } } nm_clear_g_signal_handler(priv->act_request.obj, &priv->controller_ready_id); - if (master) - master_ready(self, active); + if (controller) + controller_ready(self, active); else if (priv->controller) { - nm_device_master_release_slave(priv->controller, - self, - RELEASE_SLAVE_TYPE_CONFIG_FORCE, - NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); + nm_device_controller_release_port(priv->controller, + self, + RELEASE_PORT_TYPE_CONFIG_FORCE, + NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); } nm_device_activate_schedule_stage2_device_config(self, TRUE); @@ -10447,7 +10455,7 @@ activate_stage2_device_config(NMDevice *self) NMActStageReturn ret; NMSettingWired *s_wired; gboolean no_firmware = FALSE; - SlaveInfo *info; + PortInfo *info; NMTernary accept_all_mac_addresses; nm_device_state_changed(self, NM_DEVICE_STATE_CONFIG, NM_DEVICE_STATE_REASON_NONE); @@ -10495,17 +10503,17 @@ activate_stage2_device_config(NMDevice *self) } } - /* If we have slaves that aren't yet enslaved, do that now */ - c_list_for_each_entry (info, &priv->slaves, lst_slave) { - NMDeviceState slave_state = nm_device_get_state(info->slave); + /* If we have ports that aren't yet attached, do that now */ + c_list_for_each_entry (info, &priv->ports, lst_port) { + NMDeviceState port_state = nm_device_get_state(info->port); - if (slave_state == NM_DEVICE_STATE_IP_CONFIG) - nm_device_master_enslave_slave(self, - info->slave, - nm_device_get_applied_connection(info->slave)); + if (port_state == NM_DEVICE_STATE_IP_CONFIG) + nm_device_controller_attach_port(self, + info->port, + nm_device_get_applied_connection(info->port)); else if (priv->act_request.obj && nm_device_sys_iface_state_is_external(self) - && slave_state <= NM_DEVICE_STATE_DISCONNECTED) - nm_device_queue_recheck_assume(info->slave); + && port_state <= NM_DEVICE_STATE_DISCONNECTED) + nm_device_queue_recheck_assume(info->port); } s_wired = nm_device_get_applied_setting(self, NM_TYPE_SETTING_WIRED); @@ -11451,7 +11459,7 @@ connection_requires_carrier(NMConnection *connection) gboolean ip4_used = FALSE; gboolean ip6_used = FALSE; - /* We can progress to IP_CONFIG now, so that we're enslaved. + /* We can progress to IP_CONFIG now, so that we're attached as port. * That may actually cause carrier to go up and thus continue activation. */ s_con = nm_connection_get_setting_connection(connection); if (nm_setting_connection_get_controller(s_con)) @@ -11490,17 +11498,17 @@ connection_requires_carrier(NMConnection *connection) } static gboolean -have_any_ready_slaves(NMDevice *self) +have_any_ready_ports(NMDevice *self) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(self); - SlaveInfo *info; + PortInfo *info; - /* Any enslaved slave is "ready" in the generic case as it's + /* Any attached port is "ready" in the generic case as it's * at least >= NM_DEVICE_STATE_IP_CONFIG and has had Layer 2 * properties set up. */ - c_list_for_each_entry (info, &priv->slaves, lst_slave) { - if (NM_DEVICE_GET_PRIVATE(info->slave)->is_enslaved) + c_list_for_each_entry (info, &priv->ports, lst_port) { + if (NM_DEVICE_GET_PRIVATE(info->port)->is_attached) return TRUE; } return FALSE; @@ -11924,10 +11932,10 @@ _set_mtu(NMDevice *self, guint32 mtu) _notify(self, PROP_MTU); if (priv->controller) { - /* changing the MTU of a slave, might require the master to reset - * its MTU. Note that the master usually cannot set a MTU larger - * then the slave's. Hence, when the slave increases the MTU, - * master might want to retry setting the MTU. */ + /* changing the MTU of a port, might require the controller to reset + * its MTU. Note that the controller usually cannot set a MTU larger + * then the port's. Hence, when the port increases the MTU, + * controller might want to retry setting the MTU. */ nm_device_commit_mtu(priv->controller); } } @@ -12042,8 +12050,8 @@ _commit_mtu(NMDevice *self) /* the interface has IPv6 enabled. The MTU with IPv6 cannot be smaller * then 1280. * - * For slave-devices (that don't have @s_ip6 we) don't do this fixup because - * it's anyway an unsolved problem when the slave configures a conflicting + * For port-devices (that don't have @s_ip6 we) don't do this fixup because + * it's anyway an unsolved problem when the port configures a conflicting * MTU. */ mtu_desired = 1280; } @@ -12145,8 +12153,8 @@ _commit_mtu(NMDevice *self) "mtu: failure to set MTU. %s", NM_IS_DEVICE_VLAN(self) ? "Is the parent's MTU size large enough?" - : (!c_list_is_empty(&priv->slaves) - ? "Are the MTU sizes of the slaves large enough?" + : (!c_list_is_empty(&priv->ports) + ? "Are the MTU sizes of the ports large enough?" : "Did you configure the MTU correctly?")); } priv->carrier_wait_until_msec = @@ -12662,7 +12670,7 @@ _dev_addrgenmode6_set(NMDevice *self, guint8 addr_gen_mode) /*****************************************************************************/ static gboolean -ip_requires_slaves(NMDevice *self, int addr_family) +ip_requires_ports(NMDevice *self, int addr_family) { const char *method; @@ -12671,7 +12679,7 @@ ip_requires_slaves(NMDevice *self, int addr_family) if (NM_IS_IPv4(addr_family)) return nm_streq(method, NM_SETTING_IP4_CONFIG_METHOD_AUTO); - /* SLAAC, DHCP, and Link-Local depend on connectivity (and thus slaves) + /* SLAAC, DHCP, and Link-Local depend on connectivity (and thus ports) * to complete addressing. SLAAC and DHCP need a peer to provide a prefix. */ return NM_IN_STRSET(method, @@ -12716,11 +12724,11 @@ activate_stage3_ip_config_for_addr_family(NMDevice *self, int addr_family, const priv->ip_data_x[IS_IPv4].wait_for_carrier = FALSE; } - if (nm_device_is_controller(self) && ip_requires_slaves(self, addr_family)) { - /* If the master has no ready slaves, and depends on slaves for + if (nm_device_is_controller(self) && ip_requires_ports(self, addr_family)) { + /* If the controller has no ready ports, and depends on ports for * a successful IP configuration attempt, then postpone IP addressing. */ - if (!have_any_ready_slaves(self)) { + if (!have_any_ready_ports(self)) { if (!priv->ip_data_x[IS_IPv4].wait_for_ports) { _LOGT_ip(addr_family, "waiting for ports"); priv->ip_data_x[IS_IPv4].wait_for_ports = TRUE; @@ -12766,10 +12774,10 @@ activate_stage3_ip_config_for_addr_family(NMDevice *self, int addr_family, const if (priv->controller) { /* If a device only has an IPv6 link-local address, * we don't generate an assumed connection. Therefore, - * when a new slave connection (without IP configuration) + * when a new port connection (without IP configuration) * is activated on the device, the link-local address * remains configured. The IP configuration of an activated - * slave should not depend on the previous state. Flush + * port should not depend on the previous state. Flush * addresses and routes on activation. */ if (ip_ifindex > 0) { @@ -14289,7 +14297,7 @@ _device_activate(NMDevice *self, NMActRequest *req) g_return_if_fail(NM_IS_ACT_REQUEST(req)); nm_assert(nm_device_is_real(self)); - /* Ensure the activation request is still valid; the master may have + /* Ensure the activation request is still valid; the controller may have * already failed in which case activation of this device should not proceed. */ if (nm_active_connection_get_state(NM_ACTIVE_CONNECTION(req)) @@ -15078,7 +15086,7 @@ NM_UTILS_FLAGS2STR_DEFINE(nm_unmanaged_flags2str, NM_UTILS_FLAGS2STR(NM_UNMANAGED_USER_CONF, "user-conf"), NM_UTILS_FLAGS2STR(NM_UNMANAGED_USER_UDEV, "user-udev"), NM_UTILS_FLAGS2STR(NM_UNMANAGED_EXTERNAL_DOWN, "external-down"), - NM_UTILS_FLAGS2STR(NM_UNMANAGED_IS_SLAVE, "is-slave"), ); + NM_UTILS_FLAGS2STR(NM_UNMANAGED_IS_PORT, "is-port"), ); static const char * _unmanaged_flags2str(NMUnmanagedFlags flags, NMUnmanagedFlags mask, char *buf, gsize len) @@ -15209,8 +15217,8 @@ _get_managed_by_flags(NMUnmanagedFlags flags, flags &= ~(NM_UNMANAGED_BY_DEFAULT | NM_UNMANAGED_USER_UDEV | NM_UNMANAGED_EXTERNAL_DOWN); } - if (NM_FLAGS_HAS(mask, NM_UNMANAGED_IS_SLAVE) && !NM_FLAGS_HAS(flags, NM_UNMANAGED_IS_SLAVE)) { - /* for an enslaved device, by-default doesn't matter */ + if (NM_FLAGS_HAS(mask, NM_UNMANAGED_IS_PORT) && !NM_FLAGS_HAS(flags, NM_UNMANAGED_IS_PORT)) { + /* for an attached device, by-default doesn't matter */ flags &= ~NM_UNMANAGED_BY_DEFAULT; } @@ -15991,8 +15999,8 @@ check_connection_available(NMDevice *self, } if (nm_device_is_controller(self)) { - /* master types are always available even without carrier. - * Making connection non-available would un-enslave slaves which + /* controller types are always available even without carrier. + * Making connection non-available would de-attach ports which * is not desired. */ return TRUE; } @@ -16446,8 +16454,8 @@ nm_device_cleanup(NMDevice *self, NMDeviceStateReason reason, CleanupType cleanu ifindex = nm_device_get_ip_ifindex(self); if (cleanup_type == CLEANUP_TYPE_DECONFIGURE) { - /* master: release slaves */ - nm_device_master_release_slaves_all(self); + /* controller: release ports */ + nm_device_controller_release_ports_all(self); /* Take out any entries in the routing table and any IP address the device had. */ if (ifindex > 0) { @@ -16469,13 +16477,13 @@ nm_device_cleanup(NMDevice *self, NMDeviceStateReason reason, CleanupType cleanu if (ifindex > 0) nm_platform_ip4_dev_route_blacklist_set(nm_device_get_platform(self), ifindex, NULL); - /* slave: mark no longer enslaved */ + /* port: mark no longer attached */ if (priv->controller && priv->ifindex > 0 - && nm_platform_link_get_master(nm_device_get_platform(self), priv->ifindex) <= 0) { - nm_device_master_release_slave(priv->controller, - self, - RELEASE_SLAVE_TYPE_NO_CONFIG, - NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); + && nm_platform_link_get_controller(nm_device_get_platform(self), priv->ifindex) <= 0) { + nm_device_controller_release_port(priv->controller, + self, + RELEASE_PORT_TYPE_NO_CONFIG, + NM_DEVICE_STATE_REASON_CONNECTION_ASSUMED); } lldp_setup(self, NM_TERNARY_FALSE); @@ -16768,7 +16776,7 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, if (state < NM_DEVICE_STATE_UNAVAILABLE || (state >= NM_DEVICE_STATE_IP_CONFIG && state < NM_DEVICE_STATE_ACTIVATED)) { - /* preserve-external-ports is used by NMCheckpoint to activate a master + /* preserve-external-ports is used by NMCheckpoint to activate a controller * device, and preserve already attached ports. This means, this state is only * relevant during the deactivation and the following activation of the * right profile. Once we are sufficiently far in the activation of the @@ -16985,7 +16993,7 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, case NM_DEVICE_STATE_FAILED: /* Usually upon failure the activation chain is interrupted in * one of the stages; but in some cases the device fails for - * external events (as a failure of master connection) while + * external events (as a failure of controller connection) while * the activation sequence is running and so we need to ensure * that the chain is terminated here. */ @@ -16996,8 +17004,8 @@ _set_state_full(NMDevice *self, NMDeviceState state, NMDeviceStateReason reason, "Activation: failed for connection '%s'", sett_conn ? nm_settings_connection_get_id(sett_conn) : "<unknown>"); - /* Notify any slaves of the unexpected failure */ - nm_device_master_release_slaves_all(self); + /* Notify any ports of the unexpected failure */ + nm_device_controller_release_ports_all(self); /* If the connection doesn't yet have a timestamp, set it to zero so that * we can distinguish between connections we've tried to activate and have @@ -17221,7 +17229,7 @@ nm_device_get_state_reason(NMDevice *self) * @flag: whether to set or clear the the flag. * * This sets an internal flag to true, which does something specific. - * For non-master devices, it has no effect. For master devices, this + * For non-controller devices, it has no effect. For controller devices, this * will prevent to detach all external ports, until the next activation * completes. * @@ -18391,19 +18399,19 @@ static GVariant * _device_get_ports_variant(NMDevice *device) { NMDevicePrivate *priv = NM_DEVICE_GET_PRIVATE(device); - SlaveInfo *info; + PortInfo *info; GVariantBuilder builder; gboolean any = FALSE; if (priv->ports_variant) return priv->ports_variant; - c_list_for_each_entry (info, &priv->slaves, lst_slave) { + c_list_for_each_entry (info, &priv->ports, lst_port) { const char *path; - if (!NM_DEVICE_GET_PRIVATE(info->slave)->is_enslaved) + if (!NM_DEVICE_GET_PRIVATE(info->port)->is_attached) continue; - path = nm_dbus_object_get_path(NM_DBUS_OBJECT(info->slave)); + path = nm_dbus_object_get_path(NM_DBUS_OBJECT(info->port)); if (!path) continue; if (!any) { @@ -18690,7 +18698,7 @@ nm_device_init(NMDevice *self) c_list_init(&self->devices_lst); c_list_init(&self->devcon_dev_lst_head); c_list_init(&self->policy_auto_activate_lst); - c_list_init(&priv->slaves); + c_list_init(&priv->ports); priv->ipdhcp_data_6.v6.mode = NM_NDISC_DHCP_LEVEL_NONE; @@ -18844,7 +18852,7 @@ dispose(GObject *object) _cleanup_generic_pre(self, CLEANUP_TYPE_KEEP); - nm_assert(c_list_is_empty(&priv->slaves)); + nm_assert(c_list_is_empty(&priv->ports)); /* Let the kernel manage IPv6LL again */ _dev_addrgenmode6_set(self, NM_IN6_ADDR_GEN_MODE_EUI64); diff --git a/src/core/devices/nm-device.h b/src/core/devices/nm-device.h index ba45497c..37eda5c0 100644 --- a/src/core/devices/nm-device.h +++ b/src/core/devices/nm-device.h @@ -375,10 +375,10 @@ typedef struct _NMDeviceClass { /* Update the connection with currently configured L2 settings */ void (*update_connection)(NMDevice *device, NMConnection *connection); - gboolean (*master_update_slave_connection)(NMDevice *self, - NMDevice *slave, - NMConnection *connection, - GError **error); + gboolean (*controller_update_port_connection)(NMDevice *self, + NMDevice *port, + NMConnection *connection, + GError **error); /* Attachs a port asynchronously. Returns TRUE/FALSE on immediate * success/error; in such cases, the callback is not invoked. If the @@ -526,14 +526,14 @@ gboolean nm_device_is_available(NMDevice *dev, NMDeviceCheckDevAvailableFlags fl gboolean nm_device_has_carrier(NMDevice *dev); NMConnection *nm_device_generate_connection(NMDevice *self, - NMDevice *master, + NMDevice *controller, gboolean *out_maybe_later, GError **error); -gboolean nm_device_master_update_slave_connection(NMDevice *master, - NMDevice *slave, - NMConnection *connection, - GError **error); +gboolean nm_device_controller_update_port_connection(NMDevice *controller, + NMDevice *port, + NMConnection *connection, + GError **error); gboolean nm_device_can_auto_connect(NMDevice *self, NMSettingsConnection *sett_conn, char **specific_object); @@ -549,7 +549,7 @@ gboolean nm_device_check_connection_compatible(NMDevice *device, gboolean check_properties, GError **error); -gboolean nm_device_check_slave_connection_compatible(NMDevice *device, NMConnection *connection); +gboolean nm_device_check_port_connection_compatible(NMDevice *device, NMConnection *connection); gboolean nm_device_can_be_parent(NMDevice *device); gboolean nm_device_can_assume_connections(NMDevice *self); @@ -603,9 +603,9 @@ void nm_device_copy_ip6_dns_config(NMDevice *self, NMDevice *from_device); * them by default * @NM_UNMANAGED_USER_UDEV: %TRUE when unmanaged by user decision (via UDev rule) * @NM_UNMANAGED_EXTERNAL_DOWN: %TRUE when unmanaged because !IFF_UP and not created by NM - * @NM_UNMANAGED_IS_SLAVE: indicates that the device is enslaved. Note that - * setting the NM_UNMANAGED_IS_SLAVE to %TRUE makes no sense, this flag has only - * meaning to set a slave device as managed if the parent is managed too. + * @NM_UNMANAGED_IS_PORT: indicates that the device is attached as port. Note that + * setting the NM_UNMANAGED_IS_PORT to %TRUE makes no sense, this flag has only + * meaning to set a port device as managed if the parent is managed too. */ typedef enum { NM_UNMANAGED_NONE = 0, @@ -624,7 +624,7 @@ typedef enum { NM_UNMANAGED_USER_CONF = (1LL << 6), NM_UNMANAGED_USER_UDEV = (1LL << 7), NM_UNMANAGED_EXTERNAL_DOWN = (1LL << 8), - NM_UNMANAGED_IS_SLAVE = (1LL << 9), + NM_UNMANAGED_IS_PORT = (1LL << 9), NM_UNMANAGED_ALL = ((1LL << 10) - 1), } NMUnmanagedFlags; diff --git a/src/core/devices/ovs/nm-device-ovs-bridge.c b/src/core/devices/ovs/nm-device-ovs-bridge.c index 27d04003..09777669 100644 --- a/src/core/devices/ovs/nm-device-ovs-bridge.c +++ b/src/core/devices/ovs/nm-device-ovs-bridge.c @@ -49,7 +49,7 @@ create_and_realize(NMDevice *device, const NMPlatformLink **out_plink, GError **error) { - /* The actual backing resources will be created on enslavement by the port + /* The actual backing resources will be created on attachment by the port * when it can identify the port and the bridge. */ return TRUE; diff --git a/src/core/devices/ovs/nm-device-ovs-interface.c b/src/core/devices/ovs/nm-device-ovs-interface.c index c83451de..ac136be2 100644 --- a/src/core/devices/ovs/nm-device-ovs-interface.c +++ b/src/core/devices/ovs/nm-device-ovs-interface.c @@ -379,6 +379,7 @@ act_stage3_ip_config(NMDevice *device, int addr_family) { NMDeviceOvsInterface *self = NM_DEVICE_OVS_INTERFACE(device); NMDeviceOvsInterfacePrivate *priv = NM_DEVICE_OVS_INTERFACE_GET_PRIVATE(self); + bool old_wait_link; /* * When the ovs-interface device enters stage3, it becomes eligible to be attached to @@ -432,6 +433,7 @@ act_stage3_ip_config(NMDevice *device, int addr_family) priv->wait_link.cloned_mac_evaluated = TRUE; } + old_wait_link = priv->wait_link.waiting; priv->wait_link.waiting = TRUE; if (check_waiting_for_link(device, addr_family == AF_INET ? "stage3-ipv4" : "stage3-ipv6")) { nm_device_devip_set_state(device, addr_family, NM_DEVICE_IP_STATE_PENDING, NULL); @@ -450,6 +452,18 @@ act_stage3_ip_config(NMDevice *device, int addr_family) nm_utils_addr_family_to_char(addr_family)); priv->wait_link.waiting = FALSE; + /* + * It is possible we detect the link is ready before link_changed event does. It could happen + * because another stage3_ip_config scheduled happened right after the link is ready. + * Therefore, if we learn on this function that we are not waiting for the link anymore, + * we schedule a sync. stage3_ip_config. Otherwise, it could happen that we proceed with + * IP configuration without the needed allocated resources like DHCP client. + */ + if (old_wait_link) { + nm_device_bring_up(device); + nm_device_activate_schedule_stage3_ip_config(device, TRUE); + return; + } nm_clear_g_source_inst(&priv->wait_link.tun_set_ifindex_idle_source); nm_clear_g_signal_handler(nm_device_get_platform(device), &priv->wait_link.tun_link_signal_id); diff --git a/src/core/devices/ovs/nm-device-ovs-port.c b/src/core/devices/ovs/nm-device-ovs-port.c index e1020280..2acafba2 100644 --- a/src/core/devices/ovs/nm-device-ovs-port.c +++ b/src/core/devices/ovs/nm-device-ovs-port.c @@ -48,7 +48,7 @@ create_and_realize(NMDevice *device, const NMPlatformLink **out_plink, GError **error) { - /* The port will be added to ovsdb when an interface is enslaved, + /* The port will be added to ovsdb when an interface is attached as port, * because there's no such thing like an empty port. */ return TRUE; diff --git a/src/core/devices/team/nm-device-team.c b/src/core/devices/team/nm-device-team.c index 1f70537f..0f420a7a 100644 --- a/src/core/devices/team/nm-device-team.c +++ b/src/core/devices/team/nm-device-team.c @@ -238,10 +238,10 @@ update_connection(NMDevice *device, NMConnection *connection) /*****************************************************************************/ static gboolean -master_update_slave_connection(NMDevice *device, - NMDevice *slave, - NMConnection *connection, - GError **error) +controller_update_port_connection(NMDevice *device, + NMDevice *port, + NMConnection *connection, + GError **error) { NMDeviceTeam *self = NM_DEVICE_TEAM(device); NMSettingTeamPort *s_port; @@ -251,23 +251,24 @@ master_update_slave_connection(NMDevice *device, struct teamdctl *tdc; const char *team_port_config = NULL; const char *iface = nm_device_get_iface(device); - const char *iface_slave = nm_device_get_iface(slave); + const char *iface_port = nm_device_get_iface(port); NMConnection *applied_connection = nm_device_get_applied_connection(device); tdc = _tdc_connect_new(self, iface, &connect_error); if (!tdc) { - g_set_error(error, - NM_DEVICE_ERROR, - NM_DEVICE_ERROR_FAILED, - "update slave connection for slave '%s' failed to connect to teamd for master " - "%s (%s)", - iface_slave, - iface, - connect_error->message); + g_set_error( + error, + NM_DEVICE_ERROR, + NM_DEVICE_ERROR_FAILED, + "update port connection for port '%s' failed to connect to teamd for controller " + "%s (%s)", + iface_port, + iface, + connect_error->message); return FALSE; } - err = teamdctl_port_config_get_raw_direct(tdc, iface_slave, (char **) &team_port_config); + err = teamdctl_port_config_get_raw_direct(tdc, iface_port, (char **) &team_port_config); port_config = g_strdup(team_port_config); teamdctl_disconnect(tdc); teamdctl_free(tdc); @@ -275,9 +276,9 @@ master_update_slave_connection(NMDevice *device, g_set_error(error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_FAILED, - "update slave connection for slave '%s' failed to get configuration from teamd " - "master %s (err=%d)", - iface_slave, + "update port connection for port '%s' failed to get configuration from teamd " + "controller %s (err=%d)", + iface_port, iface, err); g_free(port_config); @@ -858,7 +859,7 @@ attach_port(NMDevice *device, const char *port_iface = nm_device_get_ip_iface(port); NMSettingTeamPort *s_team_port; - nm_device_master_check_slave_physical_port(device, port, LOGD_TEAM); + nm_device_controller_check_port_physical_port(device, port, LOGD_TEAM); if (configure) { nm_device_take_down(port, TRUE); @@ -881,9 +882,9 @@ attach_port(NMDevice *device, return FALSE; } } - success = nm_platform_link_enslave(nm_device_get_platform(device), - nm_device_get_ip_ifindex(device), - nm_device_get_ip_ifindex(port)); + success = nm_platform_link_attach_port(nm_device_get_platform(device), + nm_device_get_ip_ifindex(device), + nm_device_get_ip_ifindex(port)); nm_device_bring_up(port); if (!success) @@ -927,9 +928,9 @@ detach_port(NMDevice *device, if (ifindex_port <= 0) { _LOGD(LOGD_TEAM, "team port %s is already detached", port_iface); } else if (do_release) { - success = nm_platform_link_release(nm_device_get_platform(device), - nm_device_get_ip_ifindex(device), - ifindex_port); + success = nm_platform_link_release_port(nm_device_get_platform(device), + nm_device_get_ip_ifindex(device), + ifindex_port); if (success) _LOGI(LOGD_TEAM, "detached team port %s", port_iface); else @@ -974,7 +975,7 @@ create_and_realize(NMDevice *device, g_set_error(error, NM_DEVICE_ERROR, NM_DEVICE_ERROR_CREATION_FAILED, - "Failed to create team master interface '%s' for '%s': %s", + "Failed to create team controller interface '%s' for '%s': %s", iface, nm_connection_get_id(connection), nm_strerror(r)); @@ -1127,12 +1128,12 @@ nm_device_team_class_init(NMDeviceTeamClass *klass) device_class->connection_type_check_compatible = NM_SETTING_TEAM_SETTING_NAME; device_class->link_types = NM_DEVICE_DEFINE_LINK_TYPES(NM_LINK_TYPE_TEAM); - device_class->is_controller = TRUE; - device_class->create_and_realize = create_and_realize; - device_class->get_generic_capabilities = get_generic_capabilities; - device_class->complete_connection = complete_connection; - device_class->update_connection = update_connection; - device_class->master_update_slave_connection = master_update_slave_connection; + device_class->is_controller = TRUE; + device_class->create_and_realize = create_and_realize; + device_class->get_generic_capabilities = get_generic_capabilities; + device_class->complete_connection = complete_connection; + device_class->update_connection = update_connection; + device_class->controller_update_port_connection = controller_update_port_connection; device_class->act_stage1_prepare_also_for_external_or_assume = TRUE; device_class->act_stage1_prepare = act_stage1_prepare; diff --git a/src/core/devices/wifi/nm-device-wifi.c b/src/core/devices/wifi/nm-device-wifi.c index 206113e4..f24b9733 100644 --- a/src/core/devices/wifi/nm-device-wifi.c +++ b/src/core/devices/wifi/nm-device-wifi.c @@ -3293,8 +3293,8 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) GError *error = NULL; guint timeout; NMActRequest *request; - NMActiveConnection *master_ac; - NMDevice *master; + NMActiveConnection *controller_ac; + NMDevice *controller; nm_clear_g_source(&priv->sup_timeout_id); nm_clear_g_source(&priv->link_timeout_id); @@ -3374,10 +3374,10 @@ act_stage2_config(NMDevice *device, NMDeviceStateReason *out_failure_reason) /* Tell the supplicant in which bridge the interface is */ if ((request = nm_device_get_act_request(device)) - && (master_ac = nm_active_connection_get_controller(NM_ACTIVE_CONNECTION(request))) - && (master = nm_active_connection_get_device(master_ac)) - && nm_device_get_device_type(master) == NM_DEVICE_TYPE_BRIDGE) { - nm_supplicant_interface_set_bridge(priv->sup_iface, nm_device_get_iface(master)); + && (controller_ac = nm_active_connection_get_controller(NM_ACTIVE_CONNECTION(request))) + && (controller = nm_active_connection_get_device(controller_ac)) + && nm_device_get_device_type(controller) == NM_DEVICE_TYPE_BRIDGE) { + nm_supplicant_interface_set_bridge(priv->sup_iface, nm_device_get_iface(controller)); } else nm_supplicant_interface_set_bridge(priv->sup_iface, NULL); diff --git a/src/core/ndisc/nm-ndisc.c b/src/core/ndisc/nm-ndisc.c index ca646a6d..4800829f 100644 --- a/src/core/ndisc/nm-ndisc.c +++ b/src/core/ndisc/nm-ndisc.c @@ -170,6 +170,9 @@ nm_ndisc_data_to_l3cd(NMDedupMultiIndex *multi_idx, } if (rdata->gateways_n > 0) { + guint metric_offset = 0; + NMIcmpv6RouterPref prev_pref = NM_ICMPV6_ROUTER_PREF_INVALID; + NMPlatformIP6Route r = { .rt_source = NM_IP_CONFIG_SOURCE_NDISC, .ifindex = ifindex, @@ -180,6 +183,20 @@ nm_ndisc_data_to_l3cd(NMDedupMultiIndex *multi_idx, }; for (i = 0; i < rdata->gateways_n; i++) { + /* If we add multiple default routes with the same metric and + * different preferences, kernel merges them into a single ECMP + * route, with overall preference equal to the preference of the + * first route added. Therefore, the preference of individual routes + * is not respected. + * To avoid that, add routes with different metrics if they have + * different preferences, so that they are not merged together. Here + * the gateways are already ordered by increasing preference. */ + if (i != 0 && rdata->gateways[i].preference != prev_pref) { + metric_offset++; + } + + prev_pref = rdata->gateways[i].preference; + r.metric = metric_offset; r.gateway = rdata->gateways[i].address; r.rt_pref = rdata->gateways[i].preference; nm_assert((NMIcmpv6RouterPref) r.rt_pref == rdata->gateways[i].preference); diff --git a/src/core/nm-act-request.c b/src/core/nm-act-request.c index bed7ffde..b2ccc1ff 100644 --- a/src/core/nm-act-request.c +++ b/src/core/nm-act-request.c @@ -349,7 +349,7 @@ device_state_changed(NMActiveConnection *active, } static void -master_failed(NMActiveConnection *self) +controller_failed(NMActiveConnection *self) { NMDevice *device; NMDeviceState device_state; @@ -496,7 +496,7 @@ nm_act_request_class_init(NMActRequestClass *req_class) /* virtual methods */ object_class->dispose = dispose; object_class->get_property = get_property; - active_class->master_failed = master_failed; + active_class->controller_failed = controller_failed; active_class->device_state_changed = device_state_changed; /* properties */ diff --git a/src/core/nm-active-connection.c b/src/core/nm-active-connection.c index fd345495..ca1993cf 100644 --- a/src/core/nm-active-connection.c +++ b/src/core/nm-active-connection.c @@ -157,12 +157,12 @@ static NM_UTILS_FLAGS2STR_DEFINE( _state_flags_to_string, NMActivationStateFlags, NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_NONE, "none"), - NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_IS_MASTER, "is-master"), - NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_IS_SLAVE, "is-slave"), + NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_IS_CONTROLLER, "is-controller"), + NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_IS_PORT, "is-port"), NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_LAYER2_READY, "layer2-ready"), NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_IP4_READY, "ip4-ready"), NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_IP6_READY, "ip6-ready"), - NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_MASTER_HAS_SLAVES, "master-has-slaves"), + NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_CONTROLLER_HAS_PORTS, "controller-has-ports"), NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY, "lifetime-bound-to-profile-visibility"), NM_UTILS_FLAGS2STR(NM_ACTIVATION_STATE_FLAG_EXTERNAL, "external"), ); @@ -444,19 +444,19 @@ _set_applied_connection_take(NMActiveConnection *self, NMConnection *applied_con priv->applied_connection = applied_connection; nm_connection_clear_secrets(priv->applied_connection); - /* we determine whether the connection is a master/slave, based solely + /* we determine whether the connection is a controller/port, based solely * on the connection properties itself. */ s_con = nm_connection_get_setting_connection(priv->applied_connection); if (nm_setting_connection_get_controller(s_con)) - flags_val |= NM_ACTIVATION_STATE_FLAG_IS_SLAVE; + flags_val |= NM_ACTIVATION_STATE_FLAG_IS_PORT; - if (_nm_connection_type_is_master(nm_setting_connection_get_connection_type(s_con))) - flags_val |= NM_ACTIVATION_STATE_FLAG_IS_MASTER; + if (_nm_connection_type_is_controller(nm_setting_connection_get_connection_type(s_con))) + flags_val |= NM_ACTIVATION_STATE_FLAG_IS_CONTROLLER; nm_active_connection_set_state_flags_full(self, flags_val, - NM_ACTIVATION_STATE_FLAG_IS_MASTER - | NM_ACTIVATION_STATE_FLAG_IS_SLAVE); + NM_ACTIVATION_STATE_FLAG_IS_CONTROLLER + | NM_ACTIVATION_STATE_FLAG_IS_PORT); } void @@ -642,12 +642,12 @@ device_state_changed(NMDevice *device, } static void -device_master_changed(GObject *object, GParamSpec *pspec, gpointer user_data) +device_controller_changed(GObject *object, GParamSpec *pspec, gpointer user_data) { NMDevice *device = NM_DEVICE(object); NMActiveConnection *self = NM_ACTIVE_CONNECTION(user_data); - NMActiveConnection *master; - NMActiveConnectionState master_state; + NMActiveConnection *controller; + NMActiveConnectionState controller_state; if (NM_ACTIVE_CONNECTION(nm_device_get_act_request(device)) != self) return; @@ -655,14 +655,14 @@ device_master_changed(GObject *object, GParamSpec *pspec, gpointer user_data) return; if (!nm_active_connection_get_controller(self)) return; - g_signal_handlers_disconnect_by_func(device, G_CALLBACK(device_master_changed), self); - - master = nm_active_connection_get_controller(self); - master_state = nm_active_connection_get_state(master); - if (master_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { - /* Master failed before attaching the slave */ - if (NM_ACTIVE_CONNECTION_GET_CLASS(self)->master_failed) - NM_ACTIVE_CONNECTION_GET_CLASS(self)->master_failed(self); + g_signal_handlers_disconnect_by_func(device, G_CALLBACK(device_controller_changed), self); + + controller = nm_active_connection_get_controller(self); + controller_state = nm_active_connection_get_state(controller); + if (controller_state >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) { + /* Controller failed before attaching the port */ + if (NM_ACTIVE_CONNECTION_GET_CLASS(self)->controller_failed) + NM_ACTIVE_CONNECTION_GET_CLASS(self)->controller_failed(self); } } @@ -704,7 +704,7 @@ nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device) _device_cleanup(self); if (device) { - /* Device obviously can't be its own master */ + /* Device obviously can't be its own controller */ g_return_val_if_fail(!priv->controller || device != nm_active_connection_get_device(priv->controller), FALSE); @@ -714,7 +714,7 @@ nm_active_connection_set_device(NMActiveConnection *self, NMDevice *device) g_signal_connect(device, NM_DEVICE_STATE_CHANGED, G_CALLBACK(device_state_changed), self); g_signal_connect(device, "notify::" NM_DEVICE_CONTROLLER, - G_CALLBACK(device_master_changed), + G_CALLBACK(device_controller_changed), self); g_signal_connect(device, "notify::" NM_DEVICE_METERED, @@ -777,8 +777,8 @@ check_controller_ready(NMActiveConnection *self) gboolean signalling = FALSE; /* ActiveConnetions don't enter the ACTIVATING state until they have a - * NMDevice in PREPARE or higher states, so the master active connection's - * device will be ready to accept slaves when the master is in ACTIVATING + * NMDevice in PREPARE or higher states, so the controller active connection's + * device will be ready to accept ports when the controller is in ACTIVATING * or higher states. */ if (!priv->controller_ready && priv->controller @@ -812,18 +812,18 @@ check_controller_ready(NMActiveConnection *self) } static void -master_state_cb(NMActiveConnection *master, GParamSpec *pspec, gpointer user_data) +controller_state_cb(NMActiveConnection *controller, GParamSpec *pspec, gpointer user_data) { - NMActiveConnection *self = NM_ACTIVE_CONNECTION(user_data); - NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self); - NMActiveConnectionState master_state = nm_active_connection_get_state(master); + NMActiveConnection *self = NM_ACTIVE_CONNECTION(user_data); + NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self); + NMActiveConnectionState controller_state = nm_active_connection_get_state(controller); check_controller_ready(self); - if (master_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATING && !priv->controller_ready) { - /* Master disconnected before the slave was added */ - if (NM_ACTIVE_CONNECTION_GET_CLASS(self)->master_failed) - NM_ACTIVE_CONNECTION_GET_CLASS(self)->master_failed(self); + if (controller_state == NM_ACTIVE_CONNECTION_STATE_DEACTIVATING && !priv->controller_ready) { + /* Controller disconnected before the port was added */ + if (NM_ACTIVE_CONNECTION_GET_CLASS(self)->controller_failed) + NM_ACTIVE_CONNECTION_GET_CLASS(self)->controller_failed(self); } } @@ -880,7 +880,7 @@ nm_active_connection_set_controller(NMActiveConnection *self, NMActiveConnection } if (priv->device) { - /* Note, the master ActiveConnection may not yet have a device */ + /* Note, the controller ActiveConnection may not yet have a device */ g_return_if_fail(priv->device != nm_active_connection_get_device(controller)); } @@ -895,7 +895,7 @@ nm_active_connection_set_controller(NMActiveConnection *self, NMActiveConnection g_signal_connect(priv->controller, "notify::" NM_ACTIVE_CONNECTION_STATE, - G_CALLBACK(master_state_cb), + G_CALLBACK(controller_state_cb), self); check_controller_ready(self); @@ -1323,7 +1323,9 @@ _device_cleanup(NMActiveConnection *self) if (priv->device) { g_signal_handlers_disconnect_by_func(priv->device, G_CALLBACK(device_state_changed), self); - g_signal_handlers_disconnect_by_func(priv->device, G_CALLBACK(device_master_changed), self); + g_signal_handlers_disconnect_by_func(priv->device, + G_CALLBACK(device_controller_changed), + self); g_signal_handlers_disconnect_by_func(priv->device, G_CALLBACK(device_metered_changed), self); @@ -1345,7 +1347,7 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) NMActiveConnection *self = NM_ACTIVE_CONNECTION(object); NMActiveConnectionPrivate *priv = NM_ACTIVE_CONNECTION_GET_PRIVATE(self); char **strv; - NMDevice *master_device = NULL; + NMDevice *controller_device = NULL; switch (prop_id) { /* note that while priv->settings_connection.obj might not be set initially, @@ -1418,8 +1420,8 @@ get_property(GObject *object, guint prop_id, GValue *value, GParamSpec *pspec) case PROP_CONTROLLER: case PROP_MASTER: if (priv->controller) - master_device = nm_active_connection_get_device(priv->controller); - nm_dbus_utils_g_value_set_object_path(value, master_device); + controller_device = nm_active_connection_get_device(priv->controller); + nm_dbus_utils_g_value_set_object_path(value, controller_device); break; case PROP_INT_SUBJECT: g_value_set_object(value, priv->subject); @@ -1600,7 +1602,9 @@ dispose(GObject *object) _device_cleanup(self); if (priv->controller) { - g_signal_handlers_disconnect_by_func(priv->controller, G_CALLBACK(master_state_cb), self); + g_signal_handlers_disconnect_by_func(priv->controller, + G_CALLBACK(controller_state_cb), + self); } if (priv->controller_dev) { g_signal_handlers_disconnect_by_func(priv->controller_dev, diff --git a/src/core/nm-active-connection.h b/src/core/nm-active-connection.h index ba328302..81c8fd03 100644 --- a/src/core/nm-active-connection.h +++ b/src/core/nm-active-connection.h @@ -80,7 +80,7 @@ typedef struct { NMDeviceState new_state, NMDeviceState old_state, NMDeviceStateReason reason); - void (*master_failed)(NMActiveConnection *connection); + void (*controller_failed)(NMActiveConnection *connection); void (*device_changed)(NMActiveConnection *connection, NMDevice *new_device, diff --git a/src/core/nm-bond-manager.c b/src/core/nm-bond-manager.c index 9985fccf..71cd4ee7 100644 --- a/src/core/nm-bond-manager.c +++ b/src/core/nm-bond-manager.c @@ -696,7 +696,7 @@ _reconfigure_check(NMBondManager *self, gboolean reapply) /* Find all the connected ports that are IFF_RUNNING. */ pl_links_head_entry = nm_platform_lookup_obj_type(self->platform, NMP_OBJECT_TYPE_LINK); nmp_cache_iter_for_each_link (&pliter, pl_links_head_entry, &plink_port) { - if (plink_port->master != self->ifindex) + if (plink_port->controller != self->ifindex) continue; if (!NM_FLAGS_HAS(plink_port->n_ifi_flags, IFF_RUNNING)) continue; @@ -814,7 +814,7 @@ _link_changed_cb(NMPlatform *platform, if (ifindex == self->ifindex) goto schedule; - if (plink->master == self->ifindex) + if (plink->controller == self->ifindex) goto schedule; if (g_hash_table_contains(self->previous_ifindexes, GINT_TO_POINTER(ifindex))) diff --git a/src/core/nm-config-data.c b/src/core/nm-config-data.c index 5b330f24..9b3f958b 100644 --- a/src/core/nm-config-data.c +++ b/src/core/nm-config-data.c @@ -373,8 +373,8 @@ nm_config_data_get_iwd_config_path(const NMConfigData *self) gboolean nm_config_data_get_ignore_carrier_for_port(const NMConfigData *self, - const char *master, - const char *slave_type) + const char *controller, + const char *port_type) { const char *value; gboolean has_match; @@ -383,15 +383,15 @@ nm_config_data_get_ignore_carrier_for_port(const NMConfigData *self, g_return_val_if_fail(NM_IS_CONFIG_DATA(self), FALSE); - if (!master || !slave_type) + if (!controller || !port_type) goto out_default; - if (!nm_utils_ifname_valid_kernel(master, NULL)) + if (!nm_utils_ifname_valid_kernel(controller, NULL)) goto out_default; match_data = (NMMatchSpecDeviceData){ - .interface_name = master, - .device_type = slave_type, + .interface_name = controller, + .device_type = port_type, }; value = _config_data_get_device_config(self, @@ -412,7 +412,7 @@ nm_config_data_get_ignore_carrier_for_port(const NMConfigData *self, return m; out_default: - /* if ignore-carrier is not explicitly or detected for the master, then we assume it's + /* if ignore-carrier is not explicitly or detected for the controller, then we assume it's * enabled. This is in line with nm_config_data_get_ignore_carrier_by_device(), where * ignore-carrier is enabled based on nm_device_ignore_carrier_by_default(). */ diff --git a/src/core/nm-config-data.h b/src/core/nm-config-data.h index 0344ce90..b9427969 100644 --- a/src/core/nm-config-data.h +++ b/src/core/nm-config-data.h @@ -186,8 +186,8 @@ const char *nm_config_data_get_rc_manager(const NMConfigData *self); gboolean nm_config_data_get_systemd_resolved(const NMConfigData *self); gboolean nm_config_data_get_ignore_carrier_for_port(const NMConfigData *self, - const char *master, - const char *slave_type); + const char *controller, + const char *port_type); gboolean nm_config_data_get_ignore_carrier_by_device(const NMConfigData *self, NMDevice *device); gboolean nm_config_data_get_assume_ipv6ll_only(const NMConfigData *self, NMDevice *device); diff --git a/src/core/nm-l3-config-data.c b/src/core/nm-l3-config-data.c index 908c4d65..03c66ce0 100644 --- a/src/core/nm-l3-config-data.c +++ b/src/core/nm-l3-config-data.c @@ -3082,8 +3082,8 @@ nm_l3_config_data_new_from_platform(NMDedupMultiIndex *multi_idx, nm_assert(NM_IS_PLATFORM(platform)); nm_assert(ifindex > 0); - /* Slaves have no IP configuration */ - if (nm_platform_link_get_master(platform, ifindex) > 0) + /* Ports have no IP configuration */ + if (nm_platform_link_get_controller(platform, ifindex) > 0) return NULL; self = nm_l3_config_data_new(multi_idx, ifindex, NM_IP_CONFIG_SOURCE_KERNEL); diff --git a/src/core/nm-manager.c b/src/core/nm-manager.c index e949ea11..0a7e7b2e 100644 --- a/src/core/nm-manager.c +++ b/src/core/nm-manager.c @@ -390,13 +390,13 @@ static void policy_activating_ac_changed(GObject *object, GParamSpec *pspec, gpo static void device_has_pending_action_changed(NMDevice *device, GParamSpec *pspec, NMManager *self); static void check_if_startup_complete(NMManager *self); -static gboolean find_master(NMManager *self, - NMConnection *connection, - NMDevice *device, - NMSettingsConnection **out_master_connection, - NMDevice **out_master_device, - NMActiveConnection **out_master_ac, - GError **error); +static gboolean find_controller(NMManager *self, + NMConnection *connection, + NMDevice *device, + NMSettingsConnection **out_controller_connection, + NMDevice **out_controller_device, + NMActiveConnection **out_controller_ac, + GError **error); static void nm_manager_update_state(NMManager *manager); @@ -1908,11 +1908,11 @@ find_device_by_ip_iface(NMManager *self, const char *iface) * @self: the #NMManager * @iface: the device interface to find * @connection: a connection to ensure the returned device is compatible with - * @slave: a slave connection to ensure a master is compatible with + * @port: a port connection to ensure a controller is compatible with * - * Finds a device by interface name, preferring realized devices. If @slave - * is given, this function will only return master devices and will ensure - * @slave, when activated, can be a slave of the returned master device. If + * Finds a device by interface name, preferring realized devices. If @port + * is given, this function will only return controller devices and will ensure + * @port, when activated, can be a port of the returned controller device. If * @connection is given, this function will only consider devices that are * compatible with @connection. If @child is given, this function will only * return parent device. @@ -1923,7 +1923,7 @@ static NMDevice * find_device_by_iface(NMManager *self, const char *iface, NMConnection *connection, - NMConnection *slave, + NMConnection *port, NMConnection *child) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self); @@ -1937,10 +1937,10 @@ find_device_by_iface(NMManager *self, continue; if (connection && !nm_device_check_connection_compatible(candidate, connection, TRUE, NULL)) continue; - if (slave) { + if (port) { if (!nm_device_is_controller(candidate)) continue; - if (!nm_device_check_slave_connection_compatible(candidate, slave)) + if (!nm_device_check_port_connection_compatible(candidate, port)) continue; } if (child && !nm_device_can_be_parent(candidate)) @@ -2348,7 +2348,7 @@ remove_device(NMManager *self, NMDevice *device, gboolean quitting) _emit_device_added_removed(self, device, FALSE); } else { - /* unrealize() does not release a slave device from master and + /* unrealize() does not release a port device from controller and * clear IP configurations, do it here */ nm_device_removed(device, TRUE); } @@ -2676,7 +2676,7 @@ system_create_virtual_device(NMManager *self, NMConnection *connection) return device; } - if (!find_master(self, connection, device, NULL, NULL, NULL, &error)) { + if (!find_controller(self, connection, device, NULL, NULL, NULL, &error)) { _LOG3D(LOGD_DEVICE, connection, "skip activation: %s", error->message); return device; } @@ -3350,7 +3350,7 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat NMSettingsConnection *added; GError *error = NULL; gs_free_error GError *gen_error = NULL; - NMDevice *master = NULL; + NMDevice *controller = NULL; int ifindex = nm_device_get_ifindex(device); NMSettingsConnection *matched = NULL; NMSettingsConnection *connection_checked = NULL; @@ -3368,31 +3368,31 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat } if (ifindex) { - int master_ifindex = nm_platform_link_get_master(priv->platform, ifindex); + int controller_ifindex = nm_platform_link_get_controller(priv->platform, ifindex); - /* Check that the master is activating before assuming a - * slave connection. However, ignore ovs-system/ovs-netdev master as + /* Check that the controller is activating before assuming a + * port connection. However, ignore ovs-system/ovs-netdev controller as * we never manage it. */ - if (master_ifindex - && nm_platform_link_get_type(priv->platform, master_ifindex) + if (controller_ifindex + && nm_platform_link_get_type(priv->platform, controller_ifindex) != NM_LINK_TYPE_OPENVSWITCH) { - master = nm_manager_get_device_by_ifindex(self, master_ifindex); - if (!master) { + controller = nm_manager_get_device_by_ifindex(self, controller_ifindex); + if (!controller) { _LOG2D(LOGD_DEVICE, device, "assume: don't assume because " - "cannot generate connection for slave before its master (%s/%d)", - nm_platform_link_get_name(priv->platform, master_ifindex), - master_ifindex); + "cannot generate connection for port before its controller (%s/%d)", + nm_platform_link_get_name(priv->platform, controller_ifindex), + controller_ifindex); return NULL; } - if (!nm_device_get_act_request(master)) { + if (!nm_device_get_act_request(controller)) { _LOG2D(LOGD_DEVICE, device, "assume: don't assume because " - "cannot generate connection for slave before master %s activates", - nm_device_get_iface(master)); + "cannot generate connection for port before controller %s activates", + nm_device_get_iface(controller)); return NULL; } } @@ -3409,7 +3409,7 @@ get_existing_connection(NMManager *self, NMDevice *device, gboolean *out_generat * class attribute. Devices that support assuming existing connections must * have update_connection() implemented, otherwise * nm_device_generate_connection() returns NULL. */ - connection = nm_device_generate_connection(device, master, &maybe_later, &gen_error); + connection = nm_device_generate_connection(device, controller, &maybe_later, &gen_error); if (!connection) { if (maybe_later) { /* The device can potentially assume connections, but at this @@ -3716,7 +3716,7 @@ recheck_assume_connection(NMManager *self, NMDevice *device) { gs_unref_object NMActiveConnection *active = NULL; gs_unref_object NMAuthSubject *subject = NULL; - NMActiveConnection *master_ac; + NMActiveConnection *controller_ac; GError *error = NULL; subject = nm_auth_subject_new_internal(); @@ -3771,17 +3771,17 @@ recheck_assume_connection(NMManager *self, NMDevice *device) return FALSE; } - /* If the device is a slave or VLAN, find the master ActiveConnection */ - master_ac = NULL; - if (find_master(self, - nm_settings_connection_get_connection(sett_conn), - device, - NULL, - NULL, - &master_ac, - NULL) - && master_ac) - nm_active_connection_set_controller(active, master_ac); + /* If the device is a port or VLAN, find the controller ActiveConnection */ + controller_ac = NULL; + if (find_controller(self, + nm_settings_connection_get_connection(sett_conn), + device, + NULL, + NULL, + &controller_ac, + NULL) + && controller_ac) + nm_active_connection_set_controller(active, controller_ac); active_connection_add(self, active); nm_device_queue_activation(device, NM_ACT_REQUEST(active)); @@ -4863,131 +4863,132 @@ impl_manager_get_device_by_ip_iface(NMDBusObject *obj, } static gboolean -is_compatible_with_slave(NMConnection *master, NMConnection *slave) +is_compatible_with_port(NMConnection *controller, NMConnection *port) { NMSettingConnection *s_con; - 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); - s_con = nm_connection_get_setting_connection(slave); + s_con = nm_connection_get_setting_connection(port); g_assert(s_con); - return nm_connection_is_type(master, nm_setting_connection_get_port_type(s_con)); + return nm_connection_is_type(controller, nm_setting_connection_get_port_type(s_con)); } /** - * find_master: + * find_controller: * @self: #NMManager object - * @connection: the #NMConnection to find the master connection and device for + * @connection: the #NMConnection to find the controller connection and device for * @device: the #NMDevice, if any, which will activate @connection - * @out_master_connection: on success, the master connection of @connection if - * that master connection was found - * @out_master_device: on success, the master device of @connection if that - * master device was found - * @out_master_ac: on success, the master ActiveConnection of @connection if + * @out_controller_connection: on success, the controller connection of @connection if + * that controller connection was found + * @out_controller_device: on success, the controller device of @connection if that + * controller device was found + * @out_controller_ac: on success, the controller ActiveConnection of @connection if * there already is one * @error: the error, if an error occurred * - * Given an #NMConnection, attempts to find its master. If @connection has - * no master, this will return %TRUE and @out_master_connection and - * @out_master_device will be untouched. + * Given an #NMConnection, attempts to find its controller. If @connection has + * no controller, this will return %TRUE and @out_controller_connection and + * @out_controller_device will be untouched. * - * If @connection does have a master, then the outputs depend on what is in its - * #NMSettingConnection:master property: + * If @connection does have a controller, then the outputs depend on what is in its + * #NMSettingConnection:controller property: * - * If "master" is the ifname of an existing #NMDevice, and that device has a - * compatible master connection activated or activating on it, then - * @out_master_device, @out_master_connection, and @out_master_ac will all be - * set. If the device exists and is idle, only @out_master_device will be set. + * If "controller" is the ifname of an existing #NMDevice, and that device has a + * compatible controller connection activated or activating on it, then + * @out_controller_device, @out_controller_connection, and @out_controller_ac will all be + * set. If the device exists and is idle, only @out_controller_device will be set. * If the device exists and has an incompatible connection on it, an error * will be returned. * - * If "master" is the ifname of a non-existent device, then @out_master_device - * will be %NULL, and @out_master_connection will be a connection whose - * activation would cause the creation of that device. @out_master_ac MAY be + * If "controller" is the ifname of a non-existent device, then @out_controller_device + * will be %NULL, and @out_controller_connection will be a connection whose + * activation would cause the creation of that device. @out_controller_ac MAY be * set in this case as well (if the connection has started activating, but has * not yet created its device). * - * If "master" is the UUID of a compatible master connection, then - * @out_master_connection will be the identified connection, and @out_master_device - * and/or @out_master_ac will be set if the connection is currently activating. - * (@out_master_device will not be set if the device exists but does not have - * @out_master_connection active/activating on it.) + * If "controller" is the UUID of a compatible controller connection, then + * @out_controller_connection will be the identified connection, and @out_controller_device + * and/or @out_controller_ac will be set if the connection is currently activating. + * (@out_controller_device will not be set if the device exists but does not have + * @out_controller_connection active/activating on it.) * - * Returns: %TRUE if the master device and/or connection could be found or if - * the connection did not require a master, %FALSE otherwise + * Returns: %TRUE if the controller device and/or connection could be found or if + * the connection did not require a controller, %FALSE otherwise **/ static gboolean -find_master(NMManager *self, - NMConnection *connection, - NMDevice *device, - NMSettingsConnection **out_master_connection, - NMDevice **out_master_device, - NMActiveConnection **out_master_ac, - GError **error) +find_controller(NMManager *self, + NMConnection *connection, + NMDevice *device, + NMSettingsConnection **out_controller_connection, + NMDevice **out_controller_device, + NMActiveConnection **out_controller_ac, + GError **error) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self); NMSettingConnection *s_con; - const char *master; - NMDevice *master_device = NULL; - NMSettingsConnection *master_connection = NULL; + const char *controller; + NMDevice *controller_device = NULL; + NMSettingsConnection *controller_connection = NULL; NMSettingsConnection *const *connections; guint i; - nm_assert(!out_master_connection || !*out_master_connection); - nm_assert(!out_master_device || !*out_master_device); - nm_assert(!out_master_ac || !*out_master_ac); + nm_assert(!out_controller_connection || !*out_controller_connection); + nm_assert(!out_controller_device || !*out_controller_device); + nm_assert(!out_controller_ac || !*out_controller_ac); - s_con = nm_connection_get_setting_connection(connection); - master = nm_setting_connection_get_controller(s_con); + s_con = nm_connection_get_setting_connection(connection); + controller = nm_setting_connection_get_controller(s_con); - if (master == NULL) - return TRUE; /* success, but no master */ + if (controller == NULL) + return TRUE; /* success, but no controller */ _LOGD(LOGD_CORE, - "Looking for a master '%s' for connection '%s' (%s)", - master, + "Looking for a controller '%s' for connection '%s' (%s)", + controller, nm_connection_get_id(connection), nm_connection_get_uuid(connection)); connections = nm_settings_get_connections_sorted_by_autoconnect_priority(priv->settings, NULL); for (i = 0; connections[i]; i++) { - NMConnection *master_candidate = nm_settings_connection_get_connection(connections[i]); + NMConnection *controller_candidate = nm_settings_connection_get_connection(connections[i]); NMDevice *device_candidate; - if (nm_streq(nm_connection_get_uuid(master_candidate), master)) { - if (!is_compatible_with_slave(master_candidate, connection)) { + if (nm_streq(nm_connection_get_uuid(controller_candidate), controller)) { + if (!is_compatible_with_port(controller_candidate, connection)) { g_set_error(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED, "The active connection on %s is not compatible", - nm_device_get_iface(master_device)); + nm_device_get_iface(controller_device)); return FALSE; } _LOGD(LOGD_CORE, - "Will consider using connection '%s' (%s) as a master for '%s' (%s) " + "Will consider using connection '%s' (%s) as a controller for '%s' (%s) " "because UUID matches", - nm_connection_get_id(master_candidate), - nm_connection_get_uuid(master_candidate), + nm_connection_get_id(controller_candidate), + nm_connection_get_uuid(controller_candidate), nm_connection_get_id(connection), nm_connection_get_uuid(connection)); - master_connection = connections[i]; - } else if (nm_connection_get_interface_name(master_candidate) - && nm_streq(nm_connection_get_interface_name(master_candidate), master)) { - if (!is_compatible_with_slave(master_candidate, connection)) + controller_connection = connections[i]; + } else if (nm_connection_get_interface_name(controller_candidate) + && nm_streq(nm_connection_get_interface_name(controller_candidate), + controller)) { + if (!is_compatible_with_port(controller_candidate, connection)) continue; /* This might be good enough unless we find a better one (already active or UUID match) */ - if (!master_connection) { - master_connection = connections[i]; + if (!controller_connection) { + controller_connection = connections[i]; _LOGD(LOGD_CORE, - "Will consider using connection '%s' (%s) as a master for '%s' (%s) " + "Will consider using connection '%s' (%s) as a controller for '%s' (%s) " "because device matches", - nm_connection_get_id(master_candidate), - nm_connection_get_uuid(master_candidate), + nm_connection_get_id(controller_candidate), + nm_connection_get_uuid(controller_candidate), nm_connection_get_id(connection), nm_connection_get_uuid(connection)); } @@ -4996,24 +4997,24 @@ find_master(NMManager *self, continue; } - /* Check if the master connection is activated on some device already */ + /* Check if the controller connection is activated on some device already */ c_list_for_each_entry (device_candidate, &priv->devices_lst_head, devices_lst) { if (device_candidate == device) continue; if (nm_device_get_settings_connection(device_candidate) == connections[i]) { - master_device = device_candidate; - master_connection = connections[i]; + controller_device = device_candidate; + controller_connection = connections[i]; break; } } - if (master_device) { + if (controller_device) { /* Now we got a connection and also a device. Look no further. */ _LOGD(LOGD_CORE, - "Will use connection '%s' (%s) as a master for '%s' (%s)", - nm_connection_get_id(master_candidate), - nm_connection_get_uuid(master_candidate), + "Will use connection '%s' (%s) as a controller for '%s' (%s)", + nm_connection_get_id(controller_candidate), + nm_connection_get_uuid(controller_candidate), nm_connection_get_id(connection), nm_connection_get_uuid(connection)); @@ -5021,119 +5022,120 @@ find_master(NMManager *self, } } - if (!master_connection) { - master_device = find_device_by_iface(self, master, NULL, connection, NULL); - if (!master_device) { + if (!controller_connection) { + controller_device = find_device_by_iface(self, controller, NULL, connection, NULL); + if (!controller_device) { g_set_error(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED, "Connection or device %s not found", - master); + controller); return FALSE; } - if (master_device == device) { + if (controller_device == device) { g_set_error_literal(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED, - "Device cannot be its own master"); + "Device cannot be its own controller"); return FALSE; } _LOGD(LOGD_CORE, - "Master connection for '%s' (%s) not found, will use device '%s'", + "Controller connection for '%s' (%s) not found, will use device '%s'", nm_connection_get_id(connection), nm_connection_get_uuid(connection), - nm_device_get_iface(master_device)); + nm_device_get_iface(controller_device)); } - if (!master_device && !master_connection) { + if (!controller_device && !controller_connection) { g_set_error_literal(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_UNKNOWN_DEVICE, - "Master connection not found or invalid"); + "Controller connection not found or invalid"); return FALSE; } - NM_SET_OUT(out_master_connection, master_connection); - NM_SET_OUT(out_master_device, master_device); - if (out_master_ac && master_connection) { - *out_master_ac = active_connection_find(self, - master_connection, - NULL, - NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, - FALSE, - NULL); + NM_SET_OUT(out_controller_connection, controller_connection); + NM_SET_OUT(out_controller_device, controller_device); + if (out_controller_ac && controller_connection) { + *out_controller_ac = active_connection_find(self, + controller_connection, + NULL, + NM_ACTIVE_CONNECTION_STATE_DEACTIVATING, + FALSE, + NULL); } return TRUE; } /** - * ensure_master_active_connection: + * ensure_controller_active_connection: * @self: the #NMManager * @subject: the #NMAuthSubject representing the requestor of this activation - * @connection: the connection that should depend on @master_connection + * @connection: the connection that should depend on @controller_connection * @device: the #NMDevice, if any, which will activate @connection - * @master_connection: the master connection, or %NULL - * @master_device: the master device, or %NULL + * @controller_connection: the controller connection, or %NULL + * @controller_device: the controller device, or %NULL * @activation_reason: the reason for activation * @error: the error, if an error occurred * * Determines whether a given #NMConnection depends on another connection to - * be activated, and if so, finds that master connection or creates it. + * be activated, and if so, finds that controller connection or creates it. * - * If @master_device and @master_connection are both set then @master_connection - * MUST already be activated or activating on @master_device, and the function will + * If @controller_device and @controller_connection are both set then @controller_connection + * MUST already be activated or activating on @controller_device, and the function will * return the existing #NMActiveConnection. * - * If only @master_device is set, and it has an #NMActiveConnection, then the - * function will return it if it is a compatible master, or an error if not. If it - * doesn't have an AC, then the function will create one if a compatible master + * If only @controller_device is set, and it has an #NMActiveConnection, then the + * function will return it if it is a compatible controller, or an error if not. If it + * doesn't have an AC, then the function will create one if a compatible controller * connection exists, or return an error if not. * - * If only @master_connection is set, then this will try to find or create a compatible - * #NMDevice, and either activate @master_connection on that device or return an error. + * If only @controller_connection is set, then this will try to find or create a compatible + * #NMDevice, and either activate @controller_connection on that device or return an error. * - * Returns: the master #NMActiveConnection that the caller should depend on, or + * Returns: the controller #NMActiveConnection that the caller should depend on, or * %NULL if an error occurred */ static NMActiveConnection * -ensure_master_active_connection(NMManager *self, - NMAuthSubject *subject, - NMConnection *connection, - NMDevice *device, - NMSettingsConnection *master_connection, - NMDevice *master_device, - NMActivationReason activation_reason, - GError **error) +ensure_controller_active_connection(NMManager *self, + NMAuthSubject *subject, + NMConnection *connection, + NMDevice *device, + NMSettingsConnection *controller_connection, + NMDevice *controller_device, + NMActivationReason activation_reason, + GError **error) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(self); NMActiveConnection *ac; - NMActiveConnection *master_ac = NULL; - NMDeviceState master_state; + NMActiveConnection *controller_ac = NULL; + NMDeviceState controller_state; gboolean bind_lifetime_to_profile_visibility; g_return_val_if_fail(connection, NULL); - g_return_val_if_fail(master_connection || master_device, FALSE); + g_return_val_if_fail(controller_connection || controller_device, FALSE); bind_lifetime_to_profile_visibility = NM_FLAGS_HAS(nm_device_get_activation_state_flags(device), NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY); - /* If the master device isn't activated then we need to activate it using + /* If the controller device isn't activated then we need to activate it using * compatible connection. If it's already activating we can just proceed. */ - if (master_device) { - NMSettingsConnection *device_connection = nm_device_get_settings_connection(master_device); + if (controller_device) { + NMSettingsConnection *device_connection = + nm_device_get_settings_connection(controller_device); /* If we're passed a connection and a device, we require that connection - * be already activated on the device, eg returned from find_master(). + * be already activated on the device, eg returned from find_controller(). */ - g_assert(!master_connection || master_connection == device_connection); + g_assert(!controller_connection || controller_connection == device_connection); if (device_connection - && !is_compatible_with_slave(nm_settings_connection_get_connection(device_connection), - connection)) { + && !is_compatible_with_port(nm_settings_connection_get_connection(device_connection), + connection)) { g_set_error(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED, @@ -5142,10 +5144,11 @@ ensure_master_active_connection(NMManager *self, return NULL; } - master_state = nm_device_get_state(master_device); - if ((master_state == NM_DEVICE_STATE_ACTIVATED) || nm_device_is_activating(master_device)) { - /* Device already using master_connection */ - ac = NM_ACTIVE_CONNECTION(nm_device_get_act_request(master_device)); + controller_state = nm_device_get_state(controller_device); + if ((controller_state == NM_DEVICE_STATE_ACTIVATED) + || nm_device_is_activating(controller_device)) { + /* Device already using controller_connection */ + ac = NM_ACTIVE_CONNECTION(nm_device_get_act_request(controller_device)); g_return_val_if_fail(device_connection, ac); if (!bind_lifetime_to_profile_visibility) { @@ -5161,11 +5164,12 @@ ensure_master_active_connection(NMManager *self, /* If the device is disconnected, find a compatible connection and * activate it on the device. */ - if (master_state == NM_DEVICE_STATE_DISCONNECTED || !nm_device_is_real(master_device)) { + if (controller_state == NM_DEVICE_STATE_DISCONNECTED + || !nm_device_is_real(controller_device)) { gs_free NMSettingsConnection **connections = NULL; guint i; - g_assert(master_connection == NULL); + g_assert(controller_connection == NULL); /* Find a compatible connection and activate this device using it */ connections = nm_manager_get_activatable_connections(self, FALSE, TRUE, NULL); @@ -5173,24 +5177,24 @@ ensure_master_active_connection(NMManager *self, NMSettingsConnection *candidate = connections[i]; NMConnection *cand_conn = nm_settings_connection_get_connection(candidate); - /* Ensure eg bond/team slave and the candidate master is a - * bond/team master + /* Ensure eg bond/team port and the candidate controller is a + * bond/team controller */ - if (!is_compatible_with_slave(cand_conn, connection)) + if (!is_compatible_with_port(cand_conn, connection)) continue; if (nm_device_check_connection_available( - master_device, + controller_device, cand_conn, NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST, NULL, NULL)) { - master_ac = nm_manager_activate_connection( + controller_ac = nm_manager_activate_connection( self, candidate, NULL, NULL, - master_device, + controller_device, subject, NM_ACTIVATION_TYPE_MANAGED, activation_reason, @@ -5198,7 +5202,7 @@ ensure_master_active_connection(NMManager *self, ? NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY : NM_ACTIVATION_STATE_FLAG_NONE, error); - return master_ac; + return controller_ac; } } @@ -5214,19 +5218,19 @@ ensure_master_active_connection(NMManager *self, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED, "Device unmanaged or not available for activation"); - } else if (master_connection) { + } else if (controller_connection) { NMDevice *candidate; /* Find a compatible device and activate it using this connection */ c_list_for_each_entry (candidate, &priv->devices_lst_head, devices_lst) { if (candidate == device) { - /* A device obviously can't be its own master */ + /* A device obviously can't be its own controller */ continue; } if (!nm_device_check_connection_available( candidate, - nm_settings_connection_get_connection(master_connection), + nm_settings_connection_get_connection(controller_connection), NM_DEVICE_CHECK_CON_AVAILABLE_FOR_USER_REQUEST, NULL, NULL)) @@ -5238,9 +5242,9 @@ ensure_master_active_connection(NMManager *self, NM_DEVICE_STATE_DEACTIVATING)) continue; - master_ac = nm_manager_activate_connection( + controller_ac = nm_manager_activate_connection( self, - master_connection, + controller_connection, NULL, NULL, candidate, @@ -5251,7 +5255,7 @@ ensure_master_active_connection(NMManager *self, ? NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY : NM_ACTIVATION_STATE_FLAG_NONE, error); - return master_ac; + return controller_ac; } g_set_error(error, @@ -5267,37 +5271,37 @@ ensure_master_active_connection(NMManager *self, typedef struct { NMSettingsConnection *connection; NMDevice *device; -} SlaveConnectionInfo; +} PortConnectionInfo; /** - * find_slaves: + * find_ports: * @manager: #NMManager object - * @sett_conn: the master #NMSettingsConnection to find slave connections for - * @device: the master #NMDevice for the @sett_conn - * @out_n_slaves: on return, the number of slaves found + * @sett_conn: the controller #NMSettingsConnection to find port connections for + * @device: the controller #NMDevice for the @sett_conn + * @out_n_ports: on return, the number of ports found * - * Given an #NMSettingsConnection, attempts to find its slaves. If @sett_conn is not - * master, or has not any slaves, this will return %NULL. + * Given an #NMSettingsConnection, attempts to find its ports. If @sett_conn is not + * controller, or has not any ports, this will return %NULL. * - * Returns: an array of #SlaveConnectionInfo for given master @sett_conn, or %NULL + * Returns: an array of #PortConnectionInfo for given controller @sett_conn, or %NULL **/ -static SlaveConnectionInfo * -find_slaves(NMManager *manager, - NMSettingsConnection *sett_conn, - NMDevice *device, - guint *out_n_slaves, - gboolean for_user_request) +static PortConnectionInfo * +find_ports(NMManager *manager, + NMSettingsConnection *sett_conn, + NMDevice *device, + guint *out_n_ports, + gboolean for_user_request) { NMManagerPrivate *priv = NM_MANAGER_GET_PRIVATE(manager); NMSettingsConnection *const *all_connections = NULL; guint n_all_connections; guint i; - SlaveConnectionInfo *slaves = NULL; - guint n_slaves = 0; + PortConnectionInfo *ports = NULL; + guint n_ports = 0; NMSettingConnection *s_con; gs_unref_hashtable GHashTable *devices = NULL; - nm_assert(out_n_slaves); + nm_assert(out_n_ports); s_con = nm_connection_get_setting_connection(nm_settings_connection_get_connection(sett_conn)); g_return_val_if_fail(s_con, NULL); @@ -5305,59 +5309,59 @@ find_slaves(NMManager *manager, devices = g_hash_table_new(nm_direct_hash, NULL); /* Search through all connections, not only inactive ones, because - * even if a slave was already active, it might be deactivated during - * master reactivation. + * even if a port was already active, it might be deactivated during + * controller reactivation. */ all_connections = nm_settings_get_connections_sorted_by_autoconnect_priority(priv->settings, &n_all_connections); for (i = 0; i < n_all_connections; i++) { - NMSettingsConnection *master_connection = NULL; - NMDevice *master_device = NULL; - NMDevice *slave_device; + NMSettingsConnection *controller_connection = NULL; + NMDevice *controller_device = NULL; + NMDevice *port_device; NMSettingsConnection *candidate = all_connections[i]; - find_master(manager, - nm_settings_connection_get_connection(candidate), - NULL, - &master_connection, - &master_device, - NULL, - NULL); - if ((master_connection && master_connection == sett_conn) - || (master_device && master_device == device)) { - slave_device = nm_manager_get_best_device_for_connection(manager, - candidate, - NULL, - for_user_request, - devices, - NULL); - - if (!slaves) { + find_controller(manager, + nm_settings_connection_get_connection(candidate), + NULL, + &controller_connection, + &controller_device, + NULL, + NULL); + if ((controller_connection && controller_connection == sett_conn) + || (controller_device && controller_device == device)) { + port_device = nm_manager_get_best_device_for_connection(manager, + candidate, + NULL, + for_user_request, + devices, + NULL); + + if (!ports) { /* what we allocate is quite likely much too large. Don't bother, it is only * a temporary buffer. */ - slaves = g_new(SlaveConnectionInfo, n_all_connections); + ports = g_new(PortConnectionInfo, n_all_connections); } - nm_assert(n_slaves < n_all_connections); - slaves[n_slaves++] = (SlaveConnectionInfo){ + nm_assert(n_ports < n_all_connections); + ports[n_ports++] = (PortConnectionInfo){ .connection = candidate, - .device = slave_device, + .device = port_device, }; - if (slave_device) - g_hash_table_add(devices, slave_device); + if (port_device) + g_hash_table_add(devices, port_device); } } - *out_n_slaves = n_slaves; + *out_n_ports = n_ports; - /* Warning: returns NULL if n_slaves is zero. */ - return slaves; + /* Warning: returns NULL if n_ports is zero. */ + return ports; } static gboolean -should_connect_slaves(NMConnection *connection, NMDevice *device) +should_connect_ports(NMConnection *connection, NMDevice *device) { NMSettingConnection *s_con; NMTernary val; @@ -5371,12 +5375,22 @@ should_connect_slaves(NMConnection *connection, NMDevice *device) val = nm_config_data_get_connection_default_int64(NM_CONFIG_GET_DATA, - NM_CON_DEFAULT("connection.autoconnect-slaves"), + NM_CON_DEFAULT("connection.autoconnect-ports"), device, 0, 1, -1); + /* Trust "connection.autoconnect-ports" first, if set to default fallback to the deprecated term. */ + if (val == NM_TERNARY_DEFAULT) + val = nm_config_data_get_connection_default_int64( + NM_CONFIG_GET_DATA, + NM_CON_DEFAULT("connection.autoconnect-slaves"), + device, + 0, + 1, + -1); + out: if (val == NM_TERNARY_FALSE) return FALSE; @@ -5386,12 +5400,12 @@ out: } static int -compare_slaves(gconstpointer a, gconstpointer b) +compare_ports(gconstpointer a, gconstpointer b) { - const SlaveConnectionInfo *a_info = a; - const SlaveConnectionInfo *b_info = b; + const PortConnectionInfo *a_info = a; + const PortConnectionInfo *b_info = b; - /* Slaves without a device at the end */ + /* Ports without a device at the end */ if (!a_info->device) return 1; if (!b_info->device) @@ -5401,93 +5415,95 @@ compare_slaves(gconstpointer a, gconstpointer b) } static void -autoconnect_slaves(NMManager *self, - NMSettingsConnection *master_connection, - NMDevice *master_device, - NMAuthSubject *subject, - gboolean for_user_request) +autoconnect_ports(NMManager *self, + NMSettingsConnection *controller_connection, + NMDevice *controller_device, + NMAuthSubject *subject, + gboolean for_user_request) { GError *local_err = NULL; - if (should_connect_slaves(nm_settings_connection_get_connection(master_connection), - master_device)) { - gs_free SlaveConnectionInfo *slaves = NULL; - guint i, n_slaves = 0; - gboolean bind_lifetime_to_profile_visibility; + if (should_connect_ports(nm_settings_connection_get_connection(controller_connection), + controller_device)) { + gs_free PortConnectionInfo *ports = NULL; + guint i, n_ports = 0; + gboolean bind_lifetime_to_profile_visibility; - slaves = find_slaves(self, master_connection, master_device, &n_slaves, for_user_request); - if (n_slaves > 1) { - qsort(slaves, n_slaves, sizeof(slaves[0]), compare_slaves); + ports = + find_ports(self, controller_connection, controller_device, &n_ports, for_user_request); + if (n_ports > 1) { + qsort(ports, n_ports, sizeof(ports[0]), compare_ports); } bind_lifetime_to_profile_visibility = - n_slaves > 0 - && NM_FLAGS_HAS(nm_device_get_activation_state_flags(master_device), + n_ports > 0 + && NM_FLAGS_HAS(nm_device_get_activation_state_flags(controller_device), NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY); - for (i = 0; i < n_slaves; i++) { - SlaveConnectionInfo *slave = &slaves[i]; - const char *uuid; + for (i = 0; i < n_ports; i++) { + PortConnectionInfo *port = &ports[i]; + const char *uuid; - /* To avoid loops when autoconnecting slaves, we propagate - * the UUID of the initial connection down to slaves until + /* To avoid loops when autoconnecting ports, we propagate + * the UUID of the initial connection down to ports until * the same connection is found. */ - uuid = g_object_get_qdata(G_OBJECT(master_connection), autoconnect_root_quark()); - if (nm_streq0(nm_settings_connection_get_uuid(slave->connection), uuid)) { + uuid = g_object_get_qdata(G_OBJECT(controller_connection), autoconnect_root_quark()); + if (nm_streq0(nm_settings_connection_get_uuid(port->connection), uuid)) { _LOGI(LOGD_CORE, - "will NOT activate slave connection '%s' (%s) as a dependency for master " + "will NOT activate port connection '%s' (%s) as a dependency for controller " "'%s' (%s): " "circular dependency detected", - nm_settings_connection_get_id(slave->connection), - nm_settings_connection_get_uuid(slave->connection), - nm_settings_connection_get_id(master_connection), - nm_settings_connection_get_uuid(master_connection)); + nm_settings_connection_get_id(port->connection), + nm_settings_connection_get_uuid(port->connection), + nm_settings_connection_get_id(controller_connection), + nm_settings_connection_get_uuid(controller_connection)); continue; } if (!uuid) - uuid = nm_settings_connection_get_uuid(master_connection); - g_object_set_qdata_full(G_OBJECT(slave->connection), + uuid = nm_settings_connection_get_uuid(controller_connection); + g_object_set_qdata_full(G_OBJECT(port->connection), autoconnect_root_quark(), g_strdup(uuid), g_free); - if (!slave->device) { + if (!port->device) { _LOGD(LOGD_CORE, - "will NOT activate slave connection '%s' (%s) as a dependency for master " + "will NOT activate port connection '%s' (%s) as a dependency for controller " "'%s' (%s): " "no compatible device found", - nm_settings_connection_get_id(slave->connection), - nm_settings_connection_get_uuid(slave->connection), - nm_settings_connection_get_id(master_connection), - nm_settings_connection_get_uuid(master_connection)); + nm_settings_connection_get_id(port->connection), + nm_settings_connection_get_uuid(port->connection), + nm_settings_connection_get_id(controller_connection), + nm_settings_connection_get_uuid(controller_connection)); continue; } - _LOGD(LOGD_CORE, - "will activate slave connection '%s' (%s) as a dependency for master '%s' (%s)", - nm_settings_connection_get_id(slave->connection), - nm_settings_connection_get_uuid(slave->connection), - nm_settings_connection_get_id(master_connection), - nm_settings_connection_get_uuid(master_connection)); + _LOGD( + LOGD_CORE, + "will activate port connection '%s' (%s) as a dependency for controller '%s' (%s)", + nm_settings_connection_get_id(port->connection), + nm_settings_connection_get_uuid(port->connection), + nm_settings_connection_get_id(controller_connection), + nm_settings_connection_get_uuid(controller_connection)); - /* Schedule slave activation */ + /* Schedule port activation */ nm_manager_activate_connection( self, - slave->connection, + port->connection, NULL, NULL, - slave->device, + port->device, subject, NM_ACTIVATION_TYPE_MANAGED, - NM_ACTIVATION_REASON_AUTOCONNECT_SLAVES, + NM_ACTIVATION_REASON_AUTOCONNECT_PORTS, bind_lifetime_to_profile_visibility ? NM_ACTIVATION_STATE_FLAG_LIFETIME_BOUND_TO_PROFILE_VISIBILITY : NM_ACTIVATION_STATE_FLAG_NONE, &local_err); if (local_err) { - _LOGW(LOGD_CORE, "Slave connection activation failed: %s", local_err->message); + _LOGW(LOGD_CORE, "Port connection activation failed: %s", local_err->message); g_clear_error(&local_err); } } @@ -5633,9 +5649,9 @@ active_connection_parent_active(NMActiveConnection *active, static gboolean _check_autoconnect_port(NMActiveConnection *active, - NMSettingsConnection *master_connection, - NMDevice *master_device, - NMActiveConnection *master_ac) + NMSettingsConnection *controller_connection, + NMDevice *controller_device, + NMActiveConnection *controller_ac) { NMSettingConnection *s_con; NMDevice *device; @@ -5645,7 +5661,7 @@ _check_autoconnect_port(NMActiveConnection *active, return TRUE; } - if (!master_connection) { + if (!controller_connection) { /* This is not a port. Proceed. */ return TRUE; } @@ -5667,7 +5683,8 @@ _check_autoconnect_port(NMActiveConnection *active, return TRUE; } - s_con = nm_settings_connection_get_setting(master_connection, NM_META_SETTING_TYPE_CONNECTION); + s_con = + nm_settings_connection_get_setting(controller_connection, NM_META_SETTING_TYPE_CONNECTION); if (nm_setting_connection_get_autoconnect(s_con)) { /* The controller profile has autoconnect enabled. Here we want to honor @@ -5680,7 +5697,7 @@ _check_autoconnect_port(NMActiveConnection *active, NM_CONFIG_GET_DATA, nm_setting_connection_get_interface_name(s_con), nm_setting_connection_get_connection_type(s_con))) { - /* We ignore carrier on the master (as we would do by default). Proceed. */ + /* We ignore carrier on the controller (as we would do by default). Proceed. */ return TRUE; } @@ -5691,12 +5708,12 @@ static gboolean _internal_activate_device(NMManager *self, NMActiveConnection *active, GError **error) { NMDevice *device; - NMDevice *master_device = NULL; + NMDevice *controller_device = NULL; NMConnection *applied; NMSettingsConnection *sett_conn; - NMSettingsConnection *master_connection = NULL; - NMConnection *existing_connection = NULL; - NMActiveConnection *master_ac = NULL; + NMSettingsConnection *controller_connection = NULL; + NMConnection *existing_connection = NULL; + NMActiveConnection *controller_ac = NULL; NMAuthSubject *subject; GError *local = NULL; NMConnectionMultiConnect multi_connect; @@ -5753,16 +5770,16 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** if (nm_active_connection_get_activation_type(active) == NM_ACTIVATION_TYPE_MANAGED) nm_device_sys_iface_state_set(device, NM_DEVICE_SYS_IFACE_STATE_MANAGED); - /* Try to find the master connection/device if the connection has a dependency */ - if (!find_master(self, - applied, - device, - &master_connection, - &master_device, - &master_ac, - error)) { + /* Try to find the controller connection/device if the connection has a dependency */ + if (!find_controller(self, + applied, + device, + &controller_connection, + &controller_device, + &controller_ac, + error)) { g_prefix_error(error, - "Can not find a master for %s: ", + "Can not find a controller for %s: ", nm_settings_connection_get_id(sett_conn)); return FALSE; } @@ -5786,7 +5803,7 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** * before they have layer 2 set up. */ - if (!_check_autoconnect_port(active, master_connection, master_device, master_ac)) { + if (!_check_autoconnect_port(active, controller_connection, controller_device, controller_ac)) { /* Usually, port and controller devices can (auto)connect without carrier. However, * the controller has "ignore-carrier=no" configured. If the port autoconnects, * has no carrier and the controller has ignore-carrier=no, then autoconnect @@ -5878,66 +5895,67 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** } } - /* Ensure there's a master active connection the new connection we're + /* Ensure there's a controller active connection the new connection we're * activating can depend on. */ - if (master_connection || master_device) { - if (master_connection) { + if (controller_connection || controller_device) { + if (controller_connection) { _LOGD(LOGD_CORE, - "Activation of '%s' requires master connection '%s'", + "Activation of '%s' requires controller connection '%s'", nm_settings_connection_get_id(sett_conn), - nm_settings_connection_get_id(master_connection)); + nm_settings_connection_get_id(controller_connection)); } - if (master_device) { + if (controller_device) { _LOGD(LOGD_CORE, - "Activation of '%s' requires master device '%s'", + "Activation of '%s' requires controller device '%s'", nm_settings_connection_get_id(sett_conn), - nm_device_get_ip_iface(master_device)); + nm_device_get_ip_iface(controller_device)); } - /* Ensure eg bond slave and the candidate master is a bond master */ - if (master_connection - && !is_compatible_with_slave(nm_settings_connection_get_connection(master_connection), - applied)) { + /* Ensure eg bond port and the candidate controller is a bond controller */ + if (controller_connection + && !is_compatible_with_port( + nm_settings_connection_get_connection(controller_connection), + applied)) { g_set_error(error, NM_MANAGER_ERROR, NM_MANAGER_ERROR_DEPENDENCY_FAILED, - "The master connection '%s' is not compatible with '%s'", - nm_settings_connection_get_id(master_connection), + "The controller connection '%s' is not compatible with '%s'", + nm_settings_connection_get_id(controller_connection), nm_settings_connection_get_id(sett_conn)); return FALSE; } - if (!master_ac) { - master_ac = - ensure_master_active_connection(self, - nm_active_connection_get_subject(active), - applied, - device, - master_connection, - master_device, - nm_active_connection_get_activation_reason(active), - error); - if (!master_ac) { - if (master_device) { + if (!controller_ac) { + controller_ac = ensure_controller_active_connection( + self, + nm_active_connection_get_subject(active), + applied, + device, + controller_connection, + controller_device, + nm_active_connection_get_activation_reason(active), + error); + if (!controller_ac) { + if (controller_device) { g_prefix_error(error, - "Master device '%s' can't be activated: ", - nm_device_get_ip_iface(master_device)); + "Controller device '%s' can't be activated: ", + nm_device_get_ip_iface(controller_device)); } else { g_prefix_error(error, - "Master connection '%s' can't be activated: ", - nm_settings_connection_get_id(master_connection)); + "Controller connection '%s' can't be activated: ", + nm_settings_connection_get_id(controller_connection)); } return FALSE; } } - /* Now that we're activating a slave for that master, make sure the master just - * decides to go unmanaged while we're activating (perhaps because other slaves + /* Now that we're activating a port for that controller, make sure the controller just + * decides to go unmanaged while we're activating (perhaps because other ports * go away leaving him with no kids). */ - if (master_device) { - nm_device_set_unmanaged_by_flags(master_device, + if (controller_device) { + nm_device_set_unmanaged_by_flags(controller_device, NM_UNMANAGED_EXTERNAL_DOWN, NM_UNMAN_FLAG_OP_FORGET, NM_DEVICE_STATE_REASON_USER_REQUESTED); @@ -5948,35 +5966,36 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** * controller device state change to between NM_DEVICE_STATE_PREPARE and * NM_DEVICE_STATE_ACTIVATED. */ - if ((nm_active_connection_get_state(master_ac) >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) - && master_device - && (nm_device_get_state_reason(master_device) + if ((nm_active_connection_get_state(controller_ac) + >= NM_ACTIVE_CONNECTION_STATE_DEACTIVATING) + && controller_device + && (nm_device_get_state_reason(controller_device) == NM_DEVICE_STATE_REASON_NEW_ACTIVATION)) { - nm_active_connection_set_controller_dev(active, master_device); + nm_active_connection_set_controller_dev(active, controller_device); _LOGD(LOGD_CORE, "Activation of '%s'(%s) depends on controller device %p %s", nm_settings_connection_get_id(sett_conn), nm_settings_connection_get_connection_type(sett_conn), - master_device, - nm_dbus_object_get_path(NM_DBUS_OBJECT(master_device)) ?: ""); + controller_device, + nm_dbus_object_get_path(NM_DBUS_OBJECT(controller_device)) ?: ""); } else { - nm_active_connection_set_controller(active, master_ac); + nm_active_connection_set_controller(active, controller_ac); _LOGD(LOGD_CORE, "Activation of '%s'(%s) depends on active connection %p %s", nm_settings_connection_get_id(sett_conn), nm_settings_connection_get_connection_type(sett_conn), - master_ac, - nm_dbus_object_get_path(NM_DBUS_OBJECT(master_ac)) ?: ""); + controller_ac, + nm_dbus_object_get_path(NM_DBUS_OBJECT(controller_ac)) ?: ""); } } - /* Check slaves for master connection and possibly activate them */ - autoconnect_slaves(self, - sett_conn, - device, - nm_active_connection_get_subject(active), - nm_active_connection_get_activation_reason(active) - == NM_ACTIVATION_REASON_USER_REQUEST); + /* Check ports for controller connection and possibly activate them */ + autoconnect_ports(self, + sett_conn, + device, + nm_active_connection_get_subject(active), + nm_active_connection_get_activation_reason(active) + == NM_ACTIVATION_REASON_USER_REQUEST); multi_connect = _nm_connection_get_multi_connect(nm_settings_connection_get_connection(sett_conn)); @@ -5984,7 +6003,7 @@ _internal_activate_device(NMManager *self, NMActiveConnection *active, GError ** || (multi_connect == NM_CONNECTION_MULTI_CONNECT_MANUAL_MULTIPLE && NM_IN_SET(nm_active_connection_get_activation_reason(active), NM_ACTIVATION_REASON_ASSUME, - NM_ACTIVATION_REASON_AUTOCONNECT_SLAVES, + NM_ACTIVATION_REASON_AUTOCONNECT_PORTS, NM_ACTIVATION_REASON_USER_REQUEST))) { /* the profile can be activated multiple times. Proceed. */ } else { @@ -6335,8 +6354,8 @@ nm_manager_activate_connection(NMManager *self, /* Look for a active connection that's equivalent and is already pending authorization * and eventual activation. This is used to de-duplicate concurrent activations which would * otherwise race and cause the device to disconnect and reconnect repeatedly. - * In particular, this allows the master and multiple slaves to concurrently auto-activate - * while all the slaves would use the same active-connection. */ + * In particular, this allows the controller and multiple ports to concurrently auto-activate + * while all the ports would use the same active-connection. */ c_list_for_each_entry (async_op_data, &priv->async_op_lst_head, async_op_lst) { if (async_op_data->async_op_type != ASYNC_OP_TYPE_AC_AUTH_ACTIVATE_INTERNAL) continue; diff --git a/src/core/nm-policy.c b/src/core/nm-policy.c index 4b8262f7..694f5905 100644 --- a/src/core/nm-policy.c +++ b/src/core/nm-policy.c @@ -1775,9 +1775,9 @@ _connection_autoconnect_retries_set(NMPolicy *self, static void unblock_autoconnect_for_ports(NMPolicy *self, - const char *master_device, - const char *master_uuid_settings, - const char *master_uuid_applied, + const char *controller_device, + const char *controller_uuid_settings, + const char *controller_uuid_applied, gboolean reset_devcon_autoconnect) { NMPolicyPrivate *priv = NM_POLICY_GET_PRIVATE(self); @@ -1788,11 +1788,11 @@ unblock_autoconnect_for_ports(NMPolicy *self, _LOGT(LOGD_CORE, "block-autoconnect: unblocking port profiles for controller ifname=%s%s%s, uuid=%s%s%s" "%s%s%s", - NM_PRINT_FMT_QUOTE_STRING(master_device), - NM_PRINT_FMT_QUOTE_STRING(master_uuid_settings), - NM_PRINT_FMT_QUOTED(master_uuid_applied, + NM_PRINT_FMT_QUOTE_STRING(controller_device), + NM_PRINT_FMT_QUOTE_STRING(controller_uuid_settings), + NM_PRINT_FMT_QUOTED(controller_uuid_applied, ", applied-uuid=\"", - master_uuid_applied, + controller_uuid_applied, "\"", "")); @@ -1800,16 +1800,18 @@ unblock_autoconnect_for_ports(NMPolicy *self, connections = nm_settings_get_connections(priv->settings, NULL); for (i = 0; connections[i]; i++) { NMSettingsConnection *sett_conn = connections[i]; - NMSettingConnection *s_slave_con; - const char *slave_master; + NMSettingConnection *s_port_con; + const char *port_controller; - s_slave_con = - nm_settings_connection_get_setting(sett_conn, NM_META_SETTING_TYPE_CONNECTION); - slave_master = nm_setting_connection_get_controller(s_slave_con); - if (!slave_master) + s_port_con = nm_settings_connection_get_setting(sett_conn, NM_META_SETTING_TYPE_CONNECTION); + port_controller = nm_setting_connection_get_controller(s_port_con); + if (!port_controller) continue; - if (!NM_IN_STRSET(slave_master, master_device, master_uuid_applied, master_uuid_settings)) + if (!NM_IN_STRSET(port_controller, + controller_device, + controller_uuid_applied, + controller_uuid_settings)) continue; if (reset_devcon_autoconnect) { @@ -1836,8 +1838,8 @@ unblock_autoconnect_for_ports(NMPolicy *self, static void unblock_autoconnect_for_ports_for_sett_conn(NMPolicy *self, NMSettingsConnection *sett_conn) { - const char *master_device; - const char *master_uuid_settings; + const char *controller_device; + const char *controller_uuid_settings; NMSettingConnection *s_con; nm_assert(NM_IS_POLICY(self)); @@ -1847,10 +1849,10 @@ unblock_autoconnect_for_ports_for_sett_conn(NMPolicy *self, NMSettingsConnection nm_assert(NM_IS_SETTING_CONNECTION(s_con)); - master_uuid_settings = nm_setting_connection_get_uuid(s_con); - master_device = nm_setting_connection_get_interface_name(s_con); + controller_uuid_settings = nm_setting_connection_get_uuid(s_con); + controller_device = nm_setting_connection_get_interface_name(s_con); - unblock_autoconnect_for_ports(self, master_device, master_uuid_settings, NULL, TRUE); + unblock_autoconnect_for_ports(self, controller_device, controller_uuid_settings, NULL, TRUE); } static void diff --git a/src/core/nm-types.h b/src/core/nm-types.h index 6dfdc8e2..907da0bb 100644 --- a/src/core/nm-types.h +++ b/src/core/nm-types.h @@ -68,7 +68,7 @@ typedef enum { NM_ACTIVATION_REASON_EXTERNAL, NM_ACTIVATION_REASON_ASSUME, NM_ACTIVATION_REASON_AUTOCONNECT, - NM_ACTIVATION_REASON_AUTOCONNECT_SLAVES, + NM_ACTIVATION_REASON_AUTOCONNECT_PORTS, NM_ACTIVATION_REASON_USER_REQUEST, } NMActivationReason; 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); diff --git a/src/core/ppp/nm-ppp-status.h b/src/core/ppp/nm-ppp-status.h index a2576e9c..9f7dab05 100644 --- a/src/core/ppp/nm-ppp-status.h +++ b/src/core/ppp/nm-ppp-status.h @@ -22,7 +22,7 @@ typedef enum { NM_PPP_STATUS_TERMINATE = 9, NM_PPP_STATUS_DISCONNECT = 10, NM_PPP_STATUS_HOLDOFF = 11, - NM_PPP_STATUS_MASTER = 12, + NM_PPP_STATUS_CONTROLLER = 12, /* these states are internal and not announced by the pppd plugin. */ NM_PPP_STATUS_INTERN_UNKNOWN = 20, diff --git a/src/core/ppp/nm-pppd-compat.c b/src/core/ppp/nm-pppd-compat.c index f7940c55..04e26f22 100644 --- a/src/core/ppp/nm-pppd-compat.c +++ b/src/core/ppp/nm-pppd-compat.c @@ -91,7 +91,7 @@ G_STATIC_ASSERT((gint64) NM_PPP_STATUS_RUNNING == PHASE_RUNNING); G_STATIC_ASSERT((gint64) NM_PPP_STATUS_TERMINATE == PHASE_TERMINATE); G_STATIC_ASSERT((gint64) NM_PPP_STATUS_DISCONNECT == PHASE_DISCONNECT); G_STATIC_ASSERT((gint64) NM_PPP_STATUS_HOLDOFF == PHASE_HOLDOFF); -G_STATIC_ASSERT((gint64) NM_PPP_STATUS_MASTER == PHASE_MASTER); +G_STATIC_ASSERT((gint64) NM_PPP_STATUS_CONTROLLER == PHASE_MASTER); G_STATIC_ASSERT(NM_PPPD_COMPAT_MAXNAMELEN == MAXNAMELEN); G_STATIC_ASSERT(NM_PPPD_COMPAT_MAXSECRETLEN == MAXSECRETLEN); diff --git a/src/core/ppp/nm-pppd-plugin.c b/src/core/ppp/nm-pppd-plugin.c index 93425f38..c8a866ec 100644 --- a/src/core/ppp/nm-pppd-plugin.c +++ b/src/core/ppp/nm-pppd-plugin.c @@ -73,8 +73,8 @@ nm_phasechange(int arg) case NM_PPP_STATUS_HOLDOFF: ppp_phase = "holdoff"; break; - case NM_PPP_STATUS_MASTER: - ppp_phase = "master"; + case NM_PPP_STATUS_CONTROLLER: + ppp_phase = "controller"; break; default: diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c index 7c2b2026..81964de6 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-reader.c @@ -286,21 +286,21 @@ _cert_set_from_ifcfg(gpointer setting, /*****************************************************************************/ static void -check_if_bond_slave(shvarFile *ifcfg, NMSettingConnection *s_con) +check_if_bond_port(shvarFile *ifcfg, NMSettingConnection *s_con) { gs_free char *value = NULL; const char *v; - const char *master; + const char *controller; v = svGetValueStr(ifcfg, "MASTER_UUID", &value); if (!v) v = svGetValueStr(ifcfg, "MASTER", &value); if (v) { - master = nm_setting_connection_get_controller(s_con); - if (master) { - PARSE_WARNING("Already configured as slave of %s. Ignoring MASTER{_UUID}=\"%s\"", - master, + controller = nm_setting_connection_get_controller(s_con); + if (controller) { + PARSE_WARNING("Already configured as port of %s. Ignoring MASTER{_UUID}=\"%s\"", + controller, v); return; } @@ -319,11 +319,11 @@ check_if_bond_slave(shvarFile *ifcfg, NMSettingConnection *s_con) } static void -check_if_team_slave(shvarFile *ifcfg, NMSettingConnection *s_con) +check_if_team_port(shvarFile *ifcfg, NMSettingConnection *s_con) { gs_free char *value = NULL; const char *v; - const char *master; + const char *controller; v = svGetValueStr(ifcfg, "TEAM_MASTER_UUID", &value); if (!v) @@ -331,10 +331,10 @@ check_if_team_slave(shvarFile *ifcfg, NMSettingConnection *s_con) if (!v) return; - master = nm_setting_connection_get_controller(s_con); - if (master) { - PARSE_WARNING("Already configured as slave of %s. Ignoring TEAM_MASTER{_UUID}=\"%s\"", - master, + controller = nm_setting_connection_get_controller(s_con); + if (controller) { + PARSE_WARNING("Already configured as port of %s. Ignoring TEAM_MASTER{_UUID}=\"%s\"", + controller, v); return; } @@ -508,9 +508,7 @@ make_connection_setting(const char *file, const char *old_value; if ((old_value = nm_setting_connection_get_controller(s_con))) { - PARSE_WARNING("Already configured as slave of %s. Ignoring BRIDGE=\"%s\"", - old_value, - v); + PARSE_WARNING("Already configured as port of %s. Ignoring BRIDGE=\"%s\"", old_value, v); } else { g_object_set(s_con, NM_SETTING_CONNECTION_CONTROLLER, v, NULL); g_object_set(s_con, @@ -520,8 +518,8 @@ make_connection_setting(const char *file, } } - check_if_bond_slave(ifcfg, s_con); - check_if_team_slave(ifcfg, s_con); + check_if_bond_port(ifcfg, s_con); + check_if_team_port(ifcfg, s_con); nm_clear_g_free(&value); v = svGetValueStr(ifcfg, "OVS_PORT_UUID", &value); @@ -531,7 +529,7 @@ make_connection_setting(const char *file, const char *old_value; if ((old_value = nm_setting_connection_get_controller(s_con))) { - PARSE_WARNING("Already configured as slave of %s. Ignoring OVS_PORT=\"%s\"", + PARSE_WARNING("Already configured as port of %s. Ignoring OVS_PORT=\"%s\"", old_value, v); } else { @@ -551,7 +549,7 @@ make_connection_setting(const char *file, const char *old_value; if ((old_value = nm_setting_connection_get_controller(s_con))) { - PARSE_WARNING("Already configured as slave of %s. Ignoring VRF{_UUID}=\"%s\"", + PARSE_WARNING("Already configured as port of %s. Ignoring VRF{_UUID}=\"%s\"", old_value, v); } else { @@ -6683,7 +6681,7 @@ connection_from_file_full(const char *filename, gs_free char *bond_options = NULL; if (svGetValueStr(main_ifcfg, "BONDING_OPTS", &bond_options)) { - /* initscripts consider these as bond masters */ + /* initscripts consider these as bond controllers */ g_free(type); type = g_strdup(TYPE_BOND); } diff --git a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c index f4598e2d..21f31d8b 100644 --- a/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c +++ b/src/core/settings/plugins/ifcfg-rh/nms-ifcfg-rh-writer.c @@ -2161,7 +2161,7 @@ write_connection_setting(NMSettingConnection *s_con, shvarFile *ifcfg, const cha { guint32 n, i; nm_auto_free_gstring GString *str = NULL; - const char *master, *master_iface = NULL, *type; + const char *controller, *controller_iface = NULL, *type; int vint; gint32 vint32; NMSettingConnectionMdns mdns; @@ -2191,16 +2191,16 @@ write_connection_setting(NMSettingConnection *s_con, shvarFile *ifcfg, const cha vint = nm_setting_connection_get_multi_connect(s_con); svSetValueInt64_cond(ifcfg, "MULTI_CONNECT", vint != NM_CONNECTION_MULTI_CONNECT_DEFAULT, vint); - /* Only save the value for master connections */ + /* Only save the value for controller connections */ type = nm_setting_connection_get_connection_type(s_con); - if (_nm_connection_type_is_master(type)) { - NMSettingConnectionAutoconnectSlaves autoconnect_slaves; - autoconnect_slaves = nm_setting_connection_get_autoconnect_slaves(s_con); + if (_nm_connection_type_is_controller(type)) { + NMTernary autoconnect_ports; + autoconnect_ports = nm_setting_connection_get_autoconnect_ports(s_con); svSetValueStr(ifcfg, "AUTOCONNECT_SLAVES", - autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_YES ? "yes" - : autoconnect_slaves == NM_SETTING_CONNECTION_AUTOCONNECT_SLAVES_NO ? "no" - : NULL); + autoconnect_ports == NM_TERNARY_TRUE ? "yes" + : autoconnect_ports == NM_TERNARY_FALSE ? "no" + : NULL); } switch (nm_setting_connection_get_lldp(s_con)) { case NM_SETTING_CONNECTION_LLDP_ENABLE_RX: @@ -2251,50 +2251,50 @@ write_connection_setting(NMSettingConnection *s_con, shvarFile *ifcfg, const cha mud_url = nm_setting_connection_get_mud_url(s_con); svSetValue(ifcfg, "MUD_URL", mud_url); - master = nm_setting_connection_get_controller(s_con); - if (master) { + controller = nm_setting_connection_get_controller(s_con); + if (controller) { /* The reader prefers the *_UUID variants, however we still try to resolve * it into an interface name, so that legacy tooling is not confused. */ if (!nm_utils_get_testing()) { /* This is conditional for easier testing. */ - master_iface = nm_manager_iface_for_uuid(NM_MANAGER_GET, master); + controller_iface = nm_manager_iface_for_uuid(NM_MANAGER_GET, controller); } - if (!master_iface) { - master_iface = master; - master = NULL; + if (!controller_iface) { + controller_iface = controller; + controller = NULL; } if (nm_streq0(nm_setting_connection_get_port_type(s_con), NM_SETTING_BOND_SETTING_NAME)) { - svSetValueStr(ifcfg, "MASTER_UUID", master); - svSetValueStr(ifcfg, "MASTER", master_iface); + svSetValueStr(ifcfg, "MASTER_UUID", controller); + svSetValueStr(ifcfg, "MASTER", controller_iface); svSetValueStr(ifcfg, "SLAVE", "yes"); } else if (nm_streq0(nm_setting_connection_get_port_type(s_con), NM_SETTING_BRIDGE_SETTING_NAME)) { - svSetValueStr(ifcfg, "BRIDGE_UUID", master); - svSetValueStr(ifcfg, "BRIDGE", master_iface); + svSetValueStr(ifcfg, "BRIDGE_UUID", controller); + svSetValueStr(ifcfg, "BRIDGE", controller_iface); } else if (nm_streq0(nm_setting_connection_get_port_type(s_con), NM_SETTING_TEAM_SETTING_NAME)) { - svSetValueStr(ifcfg, "TEAM_MASTER_UUID", master); - svSetValueStr(ifcfg, "TEAM_MASTER", master_iface); + svSetValueStr(ifcfg, "TEAM_MASTER_UUID", controller); + svSetValueStr(ifcfg, "TEAM_MASTER", controller_iface); if (NM_IN_STRSET(type, NM_SETTING_WIRED_SETTING_NAME, NM_SETTING_VLAN_SETTING_NAME)) svUnsetValue(ifcfg, "TYPE"); } else if (nm_streq0(nm_setting_connection_get_port_type(s_con), NM_SETTING_OVS_PORT_SETTING_NAME)) { - svSetValueStr(ifcfg, "OVS_PORT_UUID", master); - svSetValueStr(ifcfg, "OVS_PORT", master_iface); + svSetValueStr(ifcfg, "OVS_PORT_UUID", controller); + svSetValueStr(ifcfg, "OVS_PORT", controller_iface); } else if (nm_streq0(nm_setting_connection_get_port_type(s_con), NM_SETTING_VRF_SETTING_NAME)) { - svSetValueStr(ifcfg, "VRF_UUID", master); - svSetValueStr(ifcfg, "VRF", master_iface); + svSetValueStr(ifcfg, "VRF_UUID", controller); + svSetValueStr(ifcfg, "VRF", controller_iface); } else { - _LOGW("don't know how to set master for a %s slave", + _LOGW("don't know how to set controller for a %s port", nm_setting_connection_get_port_type(s_con)); } } if (nm_streq0(type, NM_SETTING_TEAM_SETTING_NAME)) svSetValueStr(ifcfg, "DEVICETYPE", TYPE_TEAM); - else if (master_iface + else if (controller_iface && nm_streq0(nm_setting_connection_get_port_type(s_con), NM_SETTING_TEAM_SETTING_NAME)) svSetValueStr(ifcfg, "DEVICETYPE", TYPE_TEAM_PORT); @@ -3056,7 +3056,7 @@ write_ip4_aliases(NMConnection *connection, const char *base_ifcfg_path) s_ip4 = nm_connection_get_setting_ip4_config(connection); if (!s_ip4) { - /* slave-type: no alias files */ + /* port-type: no alias files */ return; } diff --git a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-slave-enp31s0f1-142.cexpected b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-port-enp31s0f1-142.cexpected index b01372af..f79e5a07 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-slave-enp31s0f1-142.cexpected +++ b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-team-port-enp31s0f1-142.cexpected @@ -5,7 +5,7 @@ REORDER_HDR=yes GVRP=no MVRP=no HWADDR= -NAME=team-slave-enp31s0f1-142 +NAME=team-port-enp31s0f1-142 UUID=74f435bb-ede4-415a-9d48-f580b60eba04 DEVICE=enp31s0f1-142 ONBOOT=no diff --git a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-port-bond0 index c0de645d..c0de645d 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave +++ b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-port-bond0 diff --git a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-port-ib index 5bd9a3a8..5bd9a3a8 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-slave-ib +++ b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-bond-port-ib diff --git a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-1 b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-controller-1 index 209447b8..209447b8 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-1 +++ b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-controller-1 diff --git a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-2 b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-controller-2 index 26e448cc..26e448cc 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-2 +++ b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-controller-2 diff --git a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-invalid b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-controller-invalid index 41c0f25c..41c0f25c 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-master-invalid +++ b/src/core/settings/plugins/ifcfg-rh/tests/network-scripts/ifcfg-test-team-controller-invalid diff --git a/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c b/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c index 40a18853..334662c3 100644 --- a/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c +++ b/src/core/settings/plugins/ifcfg-rh/tests/test-ifcfg-rh.c @@ -2212,7 +2212,7 @@ test_read_dns_options(void) } static void -test_clear_master(void) +test_clear_controller(void) { nmtst_auto_unlinkfile char *testfile = NULL; gs_free char *keyfile = NULL; @@ -2221,7 +2221,7 @@ test_clear_master(void) char *unmanaged = NULL; shvarFile *f; - /* 1. load the bridge slave connection from disk */ + /* 1. load the bridge port connection from disk */ connection = _connection_from_file(TEST_IFCFG_DIR "/ifcfg-test-bridge-component", NULL, TYPE_ETHERNET, @@ -2239,7 +2239,7 @@ test_clear_master(void) TEST_IFCFG_DIR "/ifcfg-System_test-bridge-component-a.cexpected", &testfile); - /* 3. clear master and slave-type */ + /* 3. clear controller and port-type */ g_object_set(s_con, NM_SETTING_CONNECTION_MASTER, NULL, @@ -8251,13 +8251,15 @@ test_write_bond_main(void) } static void -test_read_bond_slave(void) +test_read_bond_port(void) { gs_unref_object NMConnection *connection = NULL; NMSettingConnection *s_con; - connection = - _connection_from_file(TEST_IFCFG_DIR "/ifcfg-test-bond-slave", NULL, TYPE_ETHERNET, NULL); + connection = _connection_from_file(TEST_IFCFG_DIR "/ifcfg-test-bond-port-bond0", + NULL, + TYPE_ETHERNET, + NULL); g_test_assert_expected_messages(); s_con = nmtst_connection_assert_setting(connection, NM_TYPE_SETTING_CONNECTION); @@ -8268,7 +8270,7 @@ test_read_bond_slave(void) } static void -test_write_bond_slave(void) +test_write_bond_port(void) { nmtst_auto_unlinkfile char *testfile = NULL; gs_unref_object NMConnection *connection = NULL; @@ -8309,7 +8311,7 @@ test_write_bond_slave(void) } static void -test_read_bond_port(void) +test_read_bond_port_setting(void) { gs_unref_object NMConnection *connection = NULL; NMSettingConnection *s_con = NULL; @@ -8327,7 +8329,7 @@ test_read_bond_port(void) } static void -test_write_bond_port(void) +test_write_bond_port_setting(void) { nmtst_auto_unlinkfile char *testfile = NULL; gs_unref_object NMConnection *connection = NULL; @@ -8548,13 +8550,12 @@ test_write_infiniband(gconstpointer test_data) } static void -test_read_bond_slave_ib(void) +test_read_bond_port_ib(void) { gs_unref_object NMConnection *connection = NULL; NMSettingConnection *s_con; - connection = - _connection_from_file(TEST_IFCFG_DIR "/ifcfg-test-bond-slave-ib", NULL, NULL, NULL); + connection = _connection_from_file(TEST_IFCFG_DIR "/ifcfg-test-bond-port-ib", NULL, NULL, NULL); s_con = nmtst_connection_assert_setting(connection, NM_TYPE_SETTING_CONNECTION); @@ -8563,7 +8564,7 @@ test_read_bond_slave_ib(void) } static void -test_write_bond_slave_ib(void) +test_write_bond_port_ib(void) { nmtst_auto_unlinkfile char *testfile = NULL; gs_unref_object NMConnection *connection = NULL; @@ -8990,7 +8991,7 @@ test_write_fcoe_mode(gconstpointer user_data) } static void -test_read_team_master(gconstpointer user_data) +test_read_team_controller(gconstpointer user_data) { const char *const PATH_NAME = user_data; gs_unref_object NMConnection *connection = NULL; @@ -9013,7 +9014,7 @@ test_read_team_master(gconstpointer user_data) } static void -test_read_team_master_invalid(gconstpointer user_data) +test_read_team_controller_invalid(gconstpointer user_data) { const char *const PATH_NAME = user_data; gs_free_error GError *error = NULL; @@ -9029,7 +9030,7 @@ test_read_team_master_invalid(gconstpointer user_data) } static void -test_write_team_master(void) +test_write_team_controller(void) { nmtst_auto_unlinkfile char *testfile = NULL; gs_unref_object NMConnection *connection = NULL; @@ -9236,7 +9237,7 @@ test_read_team_port_empty_config(void) } static void -test_team_reread_slave(void) +test_team_reread_port(void) { nmtst_auto_unlinkfile char *testfile = NULL; gs_unref_object NMConnection *connection_1 = NULL; @@ -9247,14 +9248,14 @@ test_team_reread_slave(void) connection_1 = nmtst_create_connection_from_keyfile("[connection]\n" - "id=team-slave-enp31s0f1-142\n" + "id=team-port-enp31s0f1-142\n" "uuid=74f435bb-ede4-415a-9d48-f580b60eba04\n" "type=vlan\n" "autoconnect=false\n" "interface-name=enp31s0f1-142\n" - "master=team142\n" + "controller=team142\n" "permissions=\n" - "slave-type=team\n" + "port-type=team\n" "\n" "[vlan]\n" "egress-priority-map=\n" @@ -9262,10 +9263,10 @@ test_team_reread_slave(void) "id=142\n" "ingress-priority-map=\n" "parent=enp31s0f1\n", - "/test_team_reread_slave"); + "/test_team_reread_port"); /* to double-check keyfile syntax, re-create the connection by hand. */ - connection_2 = nmtst_create_minimal_connection("team-slave-enp31s0f1-142", + connection_2 = nmtst_create_minimal_connection("team-port-enp31s0f1-142", "74f435bb-ede4-415a-9d48-f580b60eba04", NM_SETTING_VLAN_SETTING_NAME, &s_con); @@ -9297,7 +9298,7 @@ test_team_reread_slave(void) _writer_new_connection_reread((nmtst_get_rand_uint32() % 2) ? connection_1 : connection_2, TEST_SCRATCH_DIR, &testfile, - TEST_IFCFG_DIR "/ifcfg-team-slave-enp31s0f1-142.cexpected", + TEST_IFCFG_DIR "/ifcfg-team-port-enp31s0f1-142.cexpected", &reread, &reread_same); _assert_reread_same((nmtst_get_rand_uint32() % 2) ? connection_1 : connection_2, reread); @@ -10534,7 +10535,7 @@ main(int argc, char **argv) test_write_wired_static_ip6_only_gw); g_test_add_func(TPATH "ip6/disabled", test_write_ip6_disabled); g_test_add_func(TPATH "read-dns-options", test_read_dns_options); - g_test_add_func(TPATH "clear-master", test_clear_master); + g_test_add_func(TPATH "clear-controller", test_clear_controller); nmtst_add_test_func(TPATH "read-static", test_read_wired_static, @@ -10892,33 +10893,33 @@ main(int argc, char **argv) (gpointer) NM_SETTING_DCB_FCOE_MODE_VN2VN, test_write_fcoe_mode); - g_test_add_func(TPATH "bond/read-master", test_read_bond_main); - g_test_add_func(TPATH "bond/read-master-eth-type", test_read_bond_eth_type); - g_test_add_func(TPATH "bond/read-slave", test_read_bond_slave); - g_test_add_func(TPATH "bond/read-slave-ib", test_read_bond_slave_ib); - g_test_add_func(TPATH "bond/write-master", test_write_bond_main); - g_test_add_func(TPATH "bond/write-slave", test_write_bond_slave); - g_test_add_func(TPATH "bond/write-slave-ib", test_write_bond_slave_ib); + g_test_add_func(TPATH "bond/read-controller", test_read_bond_main); + g_test_add_func(TPATH "bond/read-controller-eth-type", test_read_bond_eth_type); + g_test_add_func(TPATH "bond/read-port", test_read_bond_port); + g_test_add_func(TPATH "bond/read-port-ib", test_read_bond_port_ib); + g_test_add_func(TPATH "bond/write-controller", test_write_bond_main); + g_test_add_func(TPATH "bond/write-port", test_write_bond_port); + g_test_add_func(TPATH "bond/write-port-ib", test_write_bond_port_ib); g_test_add_func(TPATH "bond/bonding-opts-numeric-mode", test_read_bond_opts_mode_numeric); - g_test_add_func(TPATH "bond/read-bond-port", test_read_bond_port); - g_test_add_func(TPATH "bond/write-bond-port", test_write_bond_port); + g_test_add_func(TPATH "bond/read-bond-port", test_read_bond_port_setting); + g_test_add_func(TPATH "bond/write-bond-port_setting", test_write_bond_port_setting); - g_test_add_func(TPATH "bridge/read-master", test_read_bridge_main); - g_test_add_func(TPATH "bridge/write-master", test_write_bridge_main); + g_test_add_func(TPATH "bridge/read-controller", test_read_bridge_main); + g_test_add_func(TPATH "bridge/write-controller", test_write_bridge_main); g_test_add_func(TPATH "bridge/read-component", test_read_bridge_component); g_test_add_func(TPATH "bridge/write-component", test_write_bridge_component); g_test_add_func(TPATH "bridge/read-missing-stp", test_read_bridge_missing_stp); - g_test_add_data_func(TPATH "team/read-master-1", - TEST_IFCFG_DIR "/ifcfg-test-team-master-1", - test_read_team_master); - g_test_add_data_func(TPATH "team/read-master-2", - TEST_IFCFG_DIR "/ifcfg-test-team-master-2", - test_read_team_master); - g_test_add_data_func(TPATH "team/read-master-invalid", - TEST_IFCFG_DIR "/ifcfg-test-team-master-invalid", - test_read_team_master_invalid); - g_test_add_func(TPATH "team/write-master", test_write_team_master); + g_test_add_data_func(TPATH "team/read-controller-1", + TEST_IFCFG_DIR "/ifcfg-test-team-controller-1", + test_read_team_controller); + g_test_add_data_func(TPATH "team/read-controller-2", + TEST_IFCFG_DIR "/ifcfg-test-team-controller-2", + test_read_team_controller); + g_test_add_data_func(TPATH "team/read-controller-invalid", + TEST_IFCFG_DIR "/ifcfg-test-team-controller-invalid", + test_read_team_controller_invalid); + g_test_add_func(TPATH "team/write-controller", test_write_team_controller); g_test_add_data_func(TPATH "team/read-port-1", TEST_IFCFG_DIR "/ifcfg-test-team-port-1", test_read_team_port); @@ -10928,7 +10929,7 @@ main(int argc, char **argv) g_test_add_func(TPATH "team/write-port", test_write_team_port); g_test_add_func(TPATH "team/write-infiniband-port", test_write_team_infiniband_port); g_test_add_func(TPATH "team/read-port-empty-config", test_read_team_port_empty_config); - g_test_add_func(TPATH "team/reread-slave", test_team_reread_slave); + g_test_add_func(TPATH "team/reread-port", test_team_reread_port); g_test_add_func(TPATH "proxy/read-proxy-basic", test_read_proxy_basic); g_test_add_func(TPATH "proxy/write-proxy-basic", test_write_proxy_basic); diff --git a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component index f5463ed0..0837f978 100644 --- a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component +++ b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_Bridge_Component @@ -2,8 +2,8 @@ id=Test Bridge Component uuid=d7b4f96c-c45e-4298-bef8-f48574f8c1c0 type=802-3-ethernet -master=br0 -slave-type=bridge +controller=br0 +port-type=bridge [802-3-ethernet] mac-address=00:22:15:59:62:97 diff --git a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_1 b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_1 index d3122d53..c801f164 100644 --- a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_1 +++ b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_1 @@ -1,4 +1,4 @@ [connection] type=802-3-ethernet -master=br0 -slave-type=bridge +controller=br0 +port-type=bridge diff --git a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_2 b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_2 index eb1cdace..820608f8 100644 --- a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_2 +++ b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_2 @@ -1,5 +1,5 @@ [connection] -master=br0 +controller=br0 [802-3-ethernet] diff --git a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_3 b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_3 new file mode 100644 index 00000000..9e3f9402 --- /dev/null +++ b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_3 @@ -0,0 +1,4 @@ +[connection] +controller=br0 +port-type=bridge +[802-3-ethernet] diff --git a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_4 b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_4 index 626b6f68..a9acf205 100644 --- a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_4 +++ b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_port_4 @@ -1,4 +1,4 @@ [connection] type=802-3-ethernet -master=br0 +controller=br0 [bridge-port] diff --git a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_3 b/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_3 deleted file mode 100644 index 7419e97d..00000000 --- a/src/core/settings/plugins/keyfile/tests/keyfiles/Test_minimal_slave_3 +++ /dev/null @@ -1,4 +0,0 @@ -[connection] -master=br0 -slave-type=bridge -[802-3-ethernet] diff --git a/src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c b/src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c index e3e5f84f..f999105a 100644 --- a/src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c +++ b/src/core/settings/plugins/keyfile/tests/test-keyfile-settings.c @@ -2346,13 +2346,13 @@ test_read_minimal(void) } static void -test_read_minimal_slave(void) +test_read_minimal_port(void) { gs_unref_object NMConnection *connection = NULL; gs_unref_object NMConnection *con_archetype = NULL; NMSettingConnection *s_con; - con_archetype = nmtst_create_minimal_connection("Test_minimal_slave_x", + con_archetype = nmtst_create_minimal_connection("Test_minimal_port_x", "a56b4ca5-7075-43d4-82c7-5d0cb15f7654", NM_SETTING_WIRED_SETTING_NAME, &s_con); @@ -2364,7 +2364,7 @@ test_read_minimal_slave(void) NULL); nmtst_connection_normalize(con_archetype); - connection = keyfile_read_connection_from_file(TEST_KEYFILES_DIR "/Test_minimal_slave_1"); + connection = keyfile_read_connection_from_file(TEST_KEYFILES_DIR "/Test_minimal_port_1"); g_object_set(s_con, NM_SETTING_CONNECTION_ID, nm_connection_get_id(connection), @@ -2374,7 +2374,7 @@ test_read_minimal_slave(void) nmtst_assert_connection_equals(con_archetype, FALSE, connection, FALSE); g_clear_object(&connection); - connection = keyfile_read_connection_from_file(TEST_KEYFILES_DIR "/Test_minimal_slave_2"); + connection = keyfile_read_connection_from_file(TEST_KEYFILES_DIR "/Test_minimal_port_2"); g_object_set(s_con, NM_SETTING_CONNECTION_ID, nm_connection_get_id(connection), @@ -2384,7 +2384,7 @@ test_read_minimal_slave(void) nmtst_assert_connection_equals(con_archetype, FALSE, connection, FALSE); g_clear_object(&connection); - connection = keyfile_read_connection_from_file(TEST_KEYFILES_DIR "/Test_minimal_slave_3"); + connection = keyfile_read_connection_from_file(TEST_KEYFILES_DIR "/Test_minimal_port_3"); g_object_set(s_con, NM_SETTING_CONNECTION_ID, nm_connection_get_id(connection), @@ -2394,7 +2394,7 @@ test_read_minimal_slave(void) nmtst_assert_connection_equals(con_archetype, FALSE, connection, FALSE); g_clear_object(&connection); - connection = keyfile_read_connection_from_file(TEST_KEYFILES_DIR "/Test_minimal_slave_4"); + connection = keyfile_read_connection_from_file(TEST_KEYFILES_DIR "/Test_minimal_port_4"); g_object_set(s_con, NM_SETTING_CONNECTION_ID, nm_connection_get_id(connection), @@ -2921,7 +2921,7 @@ main(int argc, char **argv) g_test_add_func("/keyfile/test_read_missing_id_uuid", test_read_missing_id_uuid); g_test_add_func("/keyfile/test_read_minimal", test_read_minimal); - g_test_add_func("/keyfile/test_read_minimal_slave", test_read_minimal_slave); + g_test_add_func("/keyfile/test_read_minimal_port", test_read_minimal_port); g_test_add_func("/keyfile/test_read_enum_property", test_read_enum_property); g_test_add_func("/keyfile/test_write_enum_property", test_write_enum_property); diff --git a/src/core/tests/test-core.c b/src/core/tests/test-core.c index e90cf6e9..c5a598a6 100644 --- a/src/core/tests/test-core.c +++ b/src/core/tests/test-core.c @@ -303,7 +303,7 @@ test_nm_utils_log_connection_diff(void) NM_SETTING_CONNECTION_ID, "id2", NM_SETTING_CONNECTION_CONTROLLER, - "master2", + "controller2", NULL); nm_utils_log_connection_diff(connection, connection2, |