summary refs log tree commit diff
path: root/src/core/devices/nm-device-bond.c
diff options
context:
space:
mode:
authorMichael Biebl <biebl@debian.org>2024-08-09 18:57:15 +0200
committerMichael Biebl <biebl@debian.org>2024-08-09 18:57:15 +0200
commite96d74409128c6a977e31f24fad9b267d2feb9a1 (patch)
tree12dad71135c6c291de457568cb973208ea8a0024 /src/core/devices/nm-device-bond.c
parent45a364c60a9d6d34e614c4f1f507c69336ad1e69 (diff)
New upstream version 1.48.8 upstream/1.48.8
Diffstat (limited to 'src/core/devices/nm-device-bond.c')
-rw-r--r--src/core/devices/nm-device-bond.c58
1 files changed, 31 insertions, 27 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;