[patch NetworkManager 07/11] team: use libteamdctl to update port config before enslave



Signed-off-by: Jiri Pirko <jiri resnulli us>
---
 src/devices/nm-device-team.c | 26 ++++++++++++++++++++++++++
 1 file changed, 26 insertions(+)

diff --git a/src/devices/nm-device-team.c b/src/devices/nm-device-team.c
index 797b2ec..187f02e 100644
--- a/src/devices/nm-device-team.c
+++ b/src/devices/nm-device-team.c
@@ -500,9 +500,35 @@ enslave_slave (NMDevice *device, NMDevice *slave, NMConnection *connection)
        gboolean success, no_firmware = FALSE;
        const char *iface = nm_device_get_ip_iface (device);
        const char *slave_iface = nm_device_get_ip_iface (slave);
+       NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (device);
+       NMSettingTeamPort *s_team_port;
 
        nm_device_take_down (slave, TRUE);
 
+       s_team_port = nm_connection_get_setting_team_port (connection);
+       if (s_team_port) {
+               const char *config = nm_setting_team_port_get_config(s_team_port);
+
+               if (config) {
+#if WITH_TEAMDCTL
+                       if (!priv->tdc) {
+                               nm_log_warn (LOGD_TEAM, "(%s): enslaved team port %s config did not changed, 
not connected to teamd",
+                                            iface, slave_iface);
+                       } else {
+                               int err;
+
+                               err = teamdctl_port_config_update_raw(priv->tdc, slave_iface, config);
+                               if (err) {
+                                       nm_log_err (LOGD_TEAM, "(%s): failed to update config for port %s", 
iface, slave_iface);
+                                       return FALSE;
+                               }
+                       }
+#else
+                       nm_log_warn (LOGD_TEAM, "(%s): enslaved team port %s config did not changed due to 
lack of Teamd control support",
+                                    iface, slave_iface);
+#endif
+               }
+       }
        success = nm_platform_link_enslave (nm_device_get_ip_ifindex (device),
                                            nm_device_get_ip_ifindex (slave));
 
-- 
1.8.3.1



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]