summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2021-09-15 17:20:36 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2021-09-20 13:27:15 +0200
commite0691f9528296b28bd455a177bdf90f9ab457c8a (patch)
tree54093af8b8bb4c68581c980f2ec530cf46dc1a1e
parent3981bff2a01482d9a6a31958d4de770c48e49e2b (diff)
downloadNetworkManager-e0691f9528296b28bd455a177bdf90f9ab457c8a.tar.gz
device: ensure tc_commit() is called only once per activation
Stage2 can be called multiple times. Ensure that tc_commit() is only called the first time. This is important now that tc synchronization requires to clear all qdiscs and recreate them.
-rw-r--r--src/core/devices/nm-device.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/core/devices/nm-device.c b/src/core/devices/nm-device.c
index 07c3930520..b70795a817 100644
--- a/src/core/devices/nm-device.c
+++ b/src/core/devices/nm-device.c
@@ -505,6 +505,7 @@ typedef struct _NMDevicePrivate {
NMDeviceStageState stage1_sriov_state : 3;
bool ip_config_started : 1;
+ bool tc_committed : 1;
char *current_stable_id;
@@ -8516,13 +8517,14 @@ activate_stage2_device_config(NMDevice *self)
_ethtool_state_set(self);
if (!nm_device_sys_iface_state_is_external_or_assume(self)) {
- if (!tc_commit(self)) {
- _LOGW(LOGD_IP6, "failed applying traffic control rules");
+ if (!priv->tc_committed && !tc_commit(self)) {
+ _LOGW(LOGD_DEVICE, "failed applying traffic control rules");
nm_device_state_changed(self,
NM_DEVICE_STATE_FAILED,
NM_DEVICE_STATE_REASON_CONFIG_FAILED);
return;
}
+ priv->tc_committed = TRUE;
}
_routing_rules_sync(self, NM_TERNARY_TRUE);
@@ -16056,6 +16058,8 @@ nm_device_cleanup(NMDevice *self, NMDeviceStateReason reason, CleanupType cleanu
}
}
+ priv->tc_committed = FALSE;
+
_routing_rules_sync(self,
cleanup_type == CLEANUP_TYPE_KEEP ? NM_TERNARY_DEFAULT : NM_TERNARY_FALSE);