summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBeniamino Galvani <bgalvani@redhat.com>2021-09-17 17:48:35 +0200
committerBeniamino Galvani <bgalvani@redhat.com>2021-09-20 13:27:16 +0200
commitd50c4eba9ec7be67920a512b6cdaa620ca6bac69 (patch)
treee0ca4e211c664dd4059ba12fb00de3ce1a9953d5
parent864e4e6369397f6cbface423773e24ff6c774dd2 (diff)
downloadNetworkManager-bg/tc-no-cache.tar.gz
core: disable tc cache by defaultbg/tc-no-cache
We no longer use tc objects from the platform cache; disable caching by default. The only exception where the cache is needed is in tc tests, as we look into the platform there to check that objects look as expected.
-rw-r--r--src/core/NetworkManagerUtils.c6
-rw-r--r--src/core/NetworkManagerUtils.h1
-rw-r--r--src/core/platform/tests/test-common.c4
-rw-r--r--src/core/platform/tests/test-tc.c2
4 files changed, 11 insertions, 2 deletions
diff --git a/src/core/NetworkManagerUtils.c b/src/core/NetworkManagerUtils.c
index 69b8d83ab4..0da8e0a949 100644
--- a/src/core/NetworkManagerUtils.c
+++ b/src/core/NetworkManagerUtils.c
@@ -1709,5 +1709,11 @@ nm_platform_get()
void
nm_linux_platform_setup(void)
{
+ nm_platform_setup(nm_linux_platform_new(FALSE, FALSE, FALSE));
+}
+
+void
+nm_linux_platform_setup_with_tc_cache(void)
+{
nm_platform_setup(nm_linux_platform_new(FALSE, FALSE, TRUE));
}
diff --git a/src/core/NetworkManagerUtils.h b/src/core/NetworkManagerUtils.h
index af5b5a5ef2..a2ac732e83 100644
--- a/src/core/NetworkManagerUtils.h
+++ b/src/core/NetworkManagerUtils.h
@@ -277,6 +277,7 @@ NMPlatform *nm_platform_get(void);
#define NM_PLATFORM_GET (nm_platform_get())
void nm_linux_platform_setup(void);
+void nm_linux_platform_setup_with_tc_cache(void);
/*****************************************************************************/
diff --git a/src/core/platform/tests/test-common.c b/src/core/platform/tests/test-common.c
index 2fc9e836ea..ad6bc114bc 100644
--- a/src/core/platform/tests/test-common.c
+++ b/src/core/platform/tests/test-common.c
@@ -37,7 +37,9 @@ gboolean
nmtstp_is_root_test(void)
{
g_assert(_nmtstp_setup_platform_func);
- return _nmtstp_setup_platform_func == nm_linux_platform_setup;
+ return NM_IN_SET(_nmtstp_setup_platform_func,
+ nm_linux_platform_setup,
+ nm_linux_platform_setup_with_tc_cache);
}
gboolean
diff --git a/src/core/platform/tests/test-tc.c b/src/core/platform/tests/test-tc.c
index 8b7e4d4a94..ee7b861ec7 100644
--- a/src/core/platform/tests/test-tc.c
+++ b/src/core/platform/tests/test-tc.c
@@ -202,7 +202,7 @@ test_qdisc_tbf(void)
/*****************************************************************************/
-NMTstpSetupFunc const _nmtstp_setup_platform_func = nm_linux_platform_setup;
+NMTstpSetupFunc const _nmtstp_setup_platform_func = nm_linux_platform_setup_with_tc_cache;
void
_nmtstp_init_tests(int *argc, char ***argv)