summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2019-09-27 09:09:32 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2019-09-27 09:44:49 +0200
commitd93767a3809c55fcced5703950be4806bbbd4df9 (patch)
tree9597bed598a4002e33d9ae3634df3c6ee08793f3
parent204256149c4870cdf0767ae047d8e16c1f90e43d (diff)
downloadNetworkManager-bg/team-delete-port-config.tar.gz
team: delete port configuration on releasebg/team-delete-port-config
If we set a port configuration upon enslaving, delete it when the port is released. https://bugzilla.redhat.com/show_bug.cgi?id=1753975
-rw-r--r--src/devices/team/nm-device-team.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/devices/team/nm-device-team.c b/src/devices/team/nm-device-team.c
index 5b537cdc63..cb8afeea53 100644
--- a/src/devices/team/nm-device-team.c
+++ b/src/devices/team/nm-device-team.c
@@ -780,29 +780,27 @@ release_slave (NMDevice *device,
{
NMDeviceTeam *self = NM_DEVICE_TEAM (device);
NMDeviceTeamPrivate *priv = NM_DEVICE_TEAM_GET_PRIVATE (self);
- gboolean success;
+ gboolean do_release, success;
+ NMSettingTeamPort *s_port;
int ifindex_slave;
int ifindex;
- if (configure) {
+ do_release = configure;
+ if (do_release) {
ifindex = nm_device_get_ifindex (device);
if ( ifindex <= 0
|| !nm_platform_link_get (nm_device_get_platform (device), ifindex))
- configure = FALSE;
+ do_release = FALSE;
}
ifindex_slave = nm_device_get_ip_ifindex (slave);
if (ifindex_slave <= 0) {
_LOGD (LOGD_TEAM, "team port %s is already released", nm_device_get_ip_iface (slave));
- return;
- }
-
- if (configure) {
+ } else if (do_release) {
success = nm_platform_link_release (nm_device_get_platform (device),
nm_device_get_ip_ifindex (device),
ifindex_slave);
-
if (success)
_LOGI (LOGD_TEAM, "released team port %s", nm_device_get_ip_iface (slave));
else
@@ -823,6 +821,13 @@ release_slave (NMDevice *device,
self);
} else
_LOGI (LOGD_TEAM, "team port %s was released", nm_device_get_ip_iface (slave));
+
+ /* Delete any port configuration we previously set */
+ if ( configure
+ && priv->tdc
+ && (s_port = nm_device_get_applied_setting (slave, NM_TYPE_SETTING_TEAM_PORT))
+ && (nm_setting_team_port_get_config (s_port)))
+ teamdctl_port_config_update_raw (priv->tdc, nm_device_get_ip_iface (slave), "{}");
}
static gboolean