summaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authorThomas Haller <thaller@redhat.com>2017-04-17 18:40:52 +0200
committerThomas Haller <thaller@redhat.com>2017-04-18 15:49:14 +0200
commit0af2f5c28b7646c687b5180a45a9124d62c0dfac (patch)
tree1a55be7e4295691bf2b55abeaebce79c22907511 /src/main.c
parentdf537d2eac44cffe4512214c87f3f303c5a350d3 (diff)
downloadNetworkManager-0af2f5c28b7646c687b5180a45a9124d62c0dfac.tar.gz
core: add NMNetns to bundle platform and route managers
NMPlatform, NMRouteManager and NMDefaultRouteManager are singletons instances. Users of those are for example NMDevice, which registers to GObject signals of both NMPlatform and NMRouteManager. Hence, as NMDevice:dispose() disconnects the signal handlers, it must ensure that those singleton instances live longer then the NMDevice instance. That is usually accomplished by having users of singleton instances own a reference to those instances. For NMDevice that effectively means that it shall own a reference to several singletons. NMPlatform, NMRouteManager, and NMDefaultRouteManager are all per-namespace. In general it doesn't make sense to have more then one instances of these per name space. Nnote that currently we don't support multiple namespaces yet. If we will ever support multiple namespaces, then a NMDevice would have a reference to all of these manager instances. Hence, introduce a new class NMNetns which bundles them together.
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/main.c b/src/main.c
index 04c837cb8f..52f3200e75 100644
--- a/src/main.c
+++ b/src/main.c
@@ -52,6 +52,7 @@
#include "nm-connectivity.h"
#include "dns/nm-dns-manager.h"
#include "systemd/nm-sd.h"
+#include "nm-netns.h"
#if !defined(NM_DIST_VERSION)
# define NM_DIST_VERSION VERSION
@@ -371,6 +372,11 @@ main (int argc, char *argv[])
#endif
);
+ /* Set up platform interaction layer */
+ nm_linux_platform_setup ();
+
+ NM_UTILS_KEEP_ALIVE (config, nm_netns_get (), "NMConfig-depends-on-NMNetns");
+
nm_auth_manager_setup (nm_config_data_get_value_boolean (nm_config_get_data_orig (config),
NM_CONFIG_KEYFILE_GROUP_MAIN,
NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT,
@@ -388,10 +394,6 @@ main (int argc, char *argv[])
}
}
- /* Set up platform interaction layer */
- nm_linux_platform_setup ();
-
- NM_UTILS_KEEP_ALIVE (config, NM_PLATFORM_GET, "NMConfig-depends-on-NMPlatform");
#if WITH_CONCHECK
NM_UTILS_KEEP_ALIVE (nm_manager_get (), nm_connectivity_get (), "NMManager-depends-on-NMConnectivity");
#endif