summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2022-10-11 15:14:04 +0200
committerLubomir Rintel <lkundrak@v3.sk>2022-10-11 16:16:36 +0200
commit45420fd39fbcd42bfc57694ea924dfa57042fa85 (patch)
tree3d68ab7502901832d75f004a16db1730a27aa8df
parent93ec6abf16a5af54b96a9ee953c3cca8cb437449 (diff)
team: set port configuration even if it's emptylr/team-default-port-conf
Call teamdctl_port_config_update_raw() when we're attaching a port even if all of team-slave setting properties are default. This is done to ensure teamd "knows" about the port (that is, "teamdctl ... port present" returns success) when we're done activating the slave connection. It will pick it up anyway from netlink, but that can happen after the activation is done, resulting in a possible race. Fixes-test: @remove_active_team_profile https://bugzilla.redhat.com/show_bug.cgi?id=2102375
-rw-r--r--src/core/devices/team/nm-device-team.c30
1 files changed, 14 insertions, 16 deletions
diff --git a/src/core/devices/team/nm-device-team.c b/src/core/devices/team/nm-device-team.c
index 49ce953df1..c3781dff2c 100644
--- a/src/core/devices/team/nm-device-team.c
+++ b/src/core/devices/team/nm-device-team.c
@@ -866,22 +866,20 @@ attach_port(NMDevice *device,
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) {
- char *sanitized_config = g_strdup(config);
- g_strdelimit(sanitized_config, "\r\n", ' ');
-
- g_hash_table_insert(priv->port_configs, g_strdup(port_iface), sanitized_config);
-
- if (!priv->tdc) {
- _LOGW(LOGD_TEAM,
- "attached team port %s config not changed, not connected to teamd",
- port_iface);
- } else {
- if (!_update_port_config(self, port_iface, sanitized_config))
- return FALSE;
- }
+ char *sanitized_config;
+
+ sanitized_config = g_strdup(nm_setting_team_port_get_config(s_team_port) ?: "{}");
+ g_strdelimit(sanitized_config, "\r\n", ' ');
+
+ g_hash_table_insert(priv->port_configs, g_strdup(port_iface), sanitized_config);
+
+ if (!priv->tdc) {
+ _LOGW(LOGD_TEAM,
+ "attached team port %s config not changed, not connected to teamd",
+ port_iface);
+ } else {
+ if (!_update_port_config(self, port_iface, sanitized_config))
+ return FALSE;
}
}
success = nm_platform_link_enslave(nm_device_get_platform(device),