mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2026-02-05 08:50:27 +01:00
nm-device-team: use libteamdctl
Signed-off-by: Jiri Pirko <jiri@resnulli.us>
This commit is contained in:
parent
2ba2390a82
commit
d55804407d
2 changed files with 35 additions and 1 deletions
|
|
@ -381,6 +381,10 @@ if SESSION_TRACKING_CK
|
|||
AM_CPPFLAGS += -DCKDB_PATH=\"${CKDB_PATH}\"
|
||||
endif
|
||||
|
||||
if WITH_TEAMDCTL
|
||||
AM_CPPFLAGS += ${LIBTEAMDCTL_CFLAGS}
|
||||
endif
|
||||
|
||||
libNetworkManager_la_SOURCES = \
|
||||
$(nm_sources) \
|
||||
$(glue_sources)
|
||||
|
|
@ -403,6 +407,10 @@ if WITH_CONCHECK
|
|||
libNetworkManager_la_LIBADD += $(LIBSOUP_LIBS)
|
||||
endif
|
||||
|
||||
if WITH_TEAMDCTL
|
||||
libNetworkManager_la_LIBADD += $(LIBTEAMDCTL_LIBS)
|
||||
endif
|
||||
|
||||
NetworkManager_LDFLAGS = -rdynamic
|
||||
|
||||
dbusservicedir = $(DBUS_SYS_DIR)
|
||||
|
|
|
|||
|
|
@ -27,8 +27,10 @@
|
|||
#include <glib.h>
|
||||
#include <glib/gi18n.h>
|
||||
#include <gio/gio.h>
|
||||
|
||||
#include <netinet/ether.h>
|
||||
#if WITH_TEAMDCTL
|
||||
#include <teamdctl.h>
|
||||
#endif
|
||||
|
||||
#include "nm-device-team.h"
|
||||
#include "nm-logging.h"
|
||||
|
|
@ -51,6 +53,9 @@ G_DEFINE_TYPE (NMDeviceTeam, nm_device_team, NM_TYPE_DEVICE)
|
|||
#define NM_TEAM_ERROR (nm_team_error_quark ())
|
||||
|
||||
typedef struct {
|
||||
#if WITH_TEAMDCTL
|
||||
struct teamdctl *tdc;
|
||||
#endif
|
||||
GPid teamd_pid;
|
||||
guint teamd_process_watch;
|
||||
guint teamd_timeout;
|
||||
|
|
@ -251,6 +256,13 @@ teamd_cleanup (NMDevice *dev)
|
|||
priv->teamd_pid = 0;
|
||||
}
|
||||
|
||||
#if WITH_TEAMDCTL
|
||||
if (priv->tdc) {
|
||||
teamdctl_disconnect (priv->tdc);
|
||||
teamdctl_free (priv->tdc);
|
||||
}
|
||||
#endif
|
||||
|
||||
teamd_timeout_remove (dev);
|
||||
|
||||
priv->teamd_on_dbus = FALSE;
|
||||
|
|
@ -285,6 +297,20 @@ teamd_dbus_appeared (GDBusConnection *connection,
|
|||
nm_log_info (LOGD_TEAM, "(%s): teamd appeared on D-Bus", nm_device_get_iface (dev));
|
||||
priv->teamd_on_dbus = FALSE;
|
||||
teamd_timeout_remove (dev);
|
||||
#if WITH_TEAMDCTL
|
||||
if (!priv->tdc) {
|
||||
int err;
|
||||
|
||||
priv->tdc = teamdctl_alloc ();
|
||||
g_assert (priv->tdc);
|
||||
err = teamdctl_connect (priv->tdc, nm_device_get_iface (dev), NULL, NULL);
|
||||
if (err) {
|
||||
nm_log_err (LOGD_TEAM, "(%s): failed to connect to teamd", nm_device_get_iface (dev));
|
||||
teamdctl_free (priv->tdc);
|
||||
priv->tdc = NULL;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
nm_device_activate_schedule_stage2_device_config (dev);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue