Now that libteam 1.9 can return port configuration, use it.  This
bumps the requirement to libteam 1.9.
---
 configure.ac                 |  2 +-
 src/devices/nm-device-team.c | 25 ++++++++++++++++++-------
 2 files changed, 19 insertions(+), 8 deletions(-)

diff --git a/configure.ac b/configure.ac
index be15f79..e59b8c2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -363,15 +363,15 @@ if (test "${enable_wimax}" = "yes"); then
        AC_DEFINE(WITH_WIMAX, 1, [Define if you have WiMAX support])
 else
        AC_DEFINE(WITH_WIMAX, 0, [Define if you have WiMAX support])
 fi
 AM_CONDITIONAL(WITH_WIMAX, test "${enable_wimax}" = "yes")
 
 # Teamd control checks
-PKG_CHECK_MODULES(LIBTEAMDCTL, [libteamdctl], 
[have_teamdctl=yes],[have_teamdctl=no])
+PKG_CHECK_MODULES(LIBTEAMDCTL, [libteamdctl >= 1.9], 
[have_teamdctl=yes],[have_teamdctl=no])
 AC_ARG_ENABLE(teamdctl, AS_HELP_STRING([--enable-teamdctl], [enable Teamd 
control support]),
                      [enable_teamdctl=${enableval}], 
[enable_teamdctl=${have_teamdctl}])
 if (test "${enable_teamdctl}" = "yes"); then
        if test x"$have_teamdctl" = x"no"; then
                AC_MSG_ERROR(Teamd control is required)
        fi
 
diff --git a/src/devices/nm-device-team.c b/src/devices/nm-device-team.c
index 8f119dd..b918a7f 100644
--- a/src/devices/nm-device-team.c
+++ b/src/devices/nm-device-team.c
@@ -272,35 +272,46 @@ nm_team_update_slave_connection (NMDevice *slave, 
NMConnection *connection)
 
        tdc = teamdctl_alloc ();
        g_assert (tdc);
        err = teamdctl_connect (tdc, master_iface, NULL, NULL);
        if (err) {
                nm_log_err (LOGD_TEAM, "(%s): failed to connect to teamd for 
master %s",
                            iface, master_iface);
-               teamdctl_free (tdc);
-               return FALSE;
+               goto done;
        }
-       /* FIXME: wait for libteamd to implement getting port config */
-/*     port_config = teamdctl_port_config_get_raw (tdc, iface); */
-       teamdctl_free (tdc);
+
+       /* Read port configuration from master teamd instance */
+       err = teamdctl_port_config_get_raw_direct (tdc, iface, &port_config);
+       if (err) {
+               g_assert (port_config == NULL);
+               nm_log_err (LOGD_TEAM, "(%s): failed to read teamd port 
configuration (%d)",
+                           iface, err);
+               goto done;
+       }
+       g_warn_if_fail (port_config != NULL);
+#else
+       nm_log_err (LOGD_TEAM, "(%s): failed to read teamd port configuration", 
iface);
 #endif
 
        s_port = nm_connection_get_setting_team_port (connection);
        if (!s_port) {
                s_port = (NMSettingTeamPort *) nm_setting_team_port_new ();
                nm_connection_add_setting (connection, NM_SETTING (s_port));
        }
 
        if (port_config) {
                g_object_set (G_OBJECT (s_port), NM_SETTING_TEAM_PORT_CONFIG, 
port_config, NULL);
                free (port_config);
                success = TRUE;
-       } else
-               nm_log_err (LOGD_TEAM, "(%s): failed to read teamd port 
configuration", iface);
+       }
 
+#if WITH_TEAMDCTL
+done:
+       teamdctl_free (tdc);
+#endif
        return success;
 }
 
 /******************************************************************/
 
 static gboolean
 ensure_killed (gpointer data)
-- 
1.8.3.1


_______________________________________________
networkmanager-list mailing list
networkmanager-list@gnome.org
https://mail.gnome.org/mailman/listinfo/networkmanager-list

Reply via email to