From ee9c73a923909e23a649407be77e25235d769e25 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Fri, 11 May 2018 22:08:45 +0200 Subject: New upstream version 1.10.8 --- src/main.c | 47 ++++++++++++++++++++++++++--------------------- 1 file changed, 26 insertions(+), 21 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index bd8e26a5..d59da052 100644 --- a/src/main.c +++ b/src/main.c @@ -39,7 +39,7 @@ #include "NetworkManagerUtils.h" #include "nm-manager.h" #include "platform/nm-linux-platform.h" -#include "nm-dbus-manager.h" +#include "nm-bus-manager.h" #include "devices/nm-device.h" #include "dhcp/nm-dhcp-manager.h" #include "nm-config.h" @@ -48,7 +48,7 @@ #include "settings/nm-settings.h" #include "nm-auth-manager.h" #include "nm-core-internal.h" -#include "nm-dbus-object.h" +#include "nm-exported-object.h" #include "nm-connectivity.h" #include "dns/nm-dns-manager.h" #include "systemd/nm-sd.h" @@ -93,10 +93,8 @@ static void _init_nm_debug (NMConfig *config) { gs_free char *debug = NULL; - enum { - D_RLIMIT_CORE = (1 << 0), - D_FATAL_WARNINGS = (1 << 1), - }; + const guint D_RLIMIT_CORE = 1; + const guint D_FATAL_WARNINGS = 2; GDebugKey keys[] = { { "RLIMIT_CORE", D_RLIMIT_CORE }, { "fatal-warnings", D_FATAL_WARNINGS }, @@ -225,7 +223,6 @@ int main (int argc, char *argv[]) { gboolean success = FALSE; - NMManager *manager; NMConfig *config; GError *error = NULL; gboolean wrote_pidfile = FALSE; @@ -233,11 +230,13 @@ main (int argc, char *argv[]) NMConfigCmdLineOptions *config_cli; guint sd_id = 0; + nm_g_type_init (); + /* Known to cause a possible deadlock upon GDBus initialization: * https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ g_type_ensure (G_TYPE_SOCKET); g_type_ensure (G_TYPE_DBUS_CONNECTION); - g_type_ensure (NM_TYPE_DBUS_MANAGER); + g_type_ensure (NM_TYPE_BUS_MANAGER); _nm_utils_is_manager_process = TRUE; @@ -395,18 +394,27 @@ main (int argc, char *argv[]) NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT, NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_BOOL)); - manager = nm_manager_setup (); + nm_manager_setup (); - if (!nm_dbus_manager_start (nm_dbus_manager_get (), - nm_manager_dbus_set_property_handle, - manager)) - goto done; + if (!nm_bus_manager_get_connection (nm_bus_manager_get ())) { + nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available"); + } else { + /* Start our DBus service */ + if (!nm_bus_manager_start_service (nm_bus_manager_get ())) { + nm_log_err (LOGD_CORE, "failed to start the dbus service."); + goto done; + } + } + +#if WITH_CONCHECK + NM_UTILS_KEEP_ALIVE (nm_manager_get (), nm_connectivity_get (), "NMManager-depends-on-NMConnectivity"); +#endif nm_dispatcher_init (); - g_signal_connect (manager, NM_MANAGER_CONFIGURE_QUIT, G_CALLBACK (manager_configure_quit), config); + g_signal_connect (nm_manager_get (), NM_MANAGER_CONFIGURE_QUIT, G_CALLBACK (manager_configure_quit), config); - if (!nm_manager_start (manager, &error)) { + if (!nm_manager_start (nm_manager_get (), &error)) { nm_log_err (LOGD_CORE, "failed to initialize: %s", error->message); goto done; } @@ -440,14 +448,11 @@ done: * state here. We don't bother updating the state as devices * change during regular operation. If NM is killed with SIGKILL, * it misses to update the state. */ - nm_manager_write_device_state (manager); + nm_manager_write_device_state (nm_manager_get ()); - /* FIXME: we don't properly shut down on exit. That is a bug. - * NMDBusObject have an assertion that they get unexported before disposing. - * We need this workaround and disable the assertion during our leaky shutdown. */ - nm_dbus_object_set_quitting (); + nm_exported_object_class_set_quitting (); - nm_manager_stop (manager); + nm_manager_stop (nm_manager_get ()); nm_config_state_set (config, TRUE, TRUE); -- cgit 1.3.0-6-gf8a5 From 04bc9e1cd3544445d883ad29ea108c1645c8e7b7 Mon Sep 17 00:00:00 2001 From: Michael Biebl Date: Mon, 4 Jun 2018 00:07:45 +0200 Subject: New upstream version 1.11.4 --- src/main.c | 48 ++++++++++++++++++++---------------------------- 1 file changed, 20 insertions(+), 28 deletions(-) (limited to 'src/main.c') diff --git a/src/main.c b/src/main.c index d59da052..c1267b27 100644 --- a/src/main.c +++ b/src/main.c @@ -39,7 +39,7 @@ #include "NetworkManagerUtils.h" #include "nm-manager.h" #include "platform/nm-linux-platform.h" -#include "nm-bus-manager.h" +#include "nm-dbus-manager.h" #include "devices/nm-device.h" #include "dhcp/nm-dhcp-manager.h" #include "nm-config.h" @@ -48,7 +48,7 @@ #include "settings/nm-settings.h" #include "nm-auth-manager.h" #include "nm-core-internal.h" -#include "nm-exported-object.h" +#include "nm-dbus-object.h" #include "nm-connectivity.h" #include "dns/nm-dns-manager.h" #include "systemd/nm-sd.h" @@ -93,8 +93,10 @@ static void _init_nm_debug (NMConfig *config) { gs_free char *debug = NULL; - const guint D_RLIMIT_CORE = 1; - const guint D_FATAL_WARNINGS = 2; + enum { + D_RLIMIT_CORE = (1 << 0), + D_FATAL_WARNINGS = (1 << 1), + }; GDebugKey keys[] = { { "RLIMIT_CORE", D_RLIMIT_CORE }, { "fatal-warnings", D_FATAL_WARNINGS }, @@ -212,7 +214,7 @@ do_early_setup (int *argc, char **argv[], NMConfigCmdLineOptions *config_cli) _("NetworkManager monitors all network connections and automatically\nchooses the best connection to use. It also allows the user to\nspecify wireless access points which wireless cards in the computer\nshould associate with."))) exit (1); - global_opt.pidfile = global_opt.pidfile ? global_opt.pidfile : g_strdup (NM_DEFAULT_PID_FILE); + global_opt.pidfile = global_opt.pidfile ?: g_strdup(NM_DEFAULT_PID_FILE); } /* @@ -223,6 +225,7 @@ int main (int argc, char *argv[]) { gboolean success = FALSE; + NMManager *manager = NULL; NMConfig *config; GError *error = NULL; gboolean wrote_pidfile = FALSE; @@ -230,13 +233,11 @@ main (int argc, char *argv[]) NMConfigCmdLineOptions *config_cli; guint sd_id = 0; - nm_g_type_init (); - /* Known to cause a possible deadlock upon GDBus initialization: * https://bugzilla.gnome.org/show_bug.cgi?id=674885 */ g_type_ensure (G_TYPE_SOCKET); g_type_ensure (G_TYPE_DBUS_CONNECTION); - g_type_ensure (NM_TYPE_BUS_MANAGER); + g_type_ensure (NM_TYPE_DBUS_MANAGER); _nm_utils_is_manager_process = TRUE; @@ -394,27 +395,19 @@ main (int argc, char *argv[]) NM_CONFIG_KEYFILE_KEY_MAIN_AUTH_POLKIT, NM_CONFIG_DEFAULT_MAIN_AUTH_POLKIT_BOOL)); - nm_manager_setup (); + if (!nm_dbus_manager_acquire_bus (nm_dbus_manager_get ())) + goto done_no_manager; - if (!nm_bus_manager_get_connection (nm_bus_manager_get ())) { - nm_log_warn (LOGD_CORE, "Failed to connect to D-Bus; only private bus is available"); - } else { - /* Start our DBus service */ - if (!nm_bus_manager_start_service (nm_bus_manager_get ())) { - nm_log_err (LOGD_CORE, "failed to start the dbus service."); - goto done; - } - } - -#if WITH_CONCHECK - NM_UTILS_KEEP_ALIVE (nm_manager_get (), nm_connectivity_get (), "NMManager-depends-on-NMConnectivity"); -#endif + manager = nm_manager_setup (); + nm_dbus_manager_start (nm_dbus_manager_get(), + nm_manager_dbus_set_property_handle, + manager); nm_dispatcher_init (); - g_signal_connect (nm_manager_get (), NM_MANAGER_CONFIGURE_QUIT, G_CALLBACK (manager_configure_quit), config); + g_signal_connect (manager, NM_MANAGER_CONFIGURE_QUIT, G_CALLBACK (manager_configure_quit), config); - if (!nm_manager_start (nm_manager_get (), &error)) { + if (!nm_manager_start (manager, &error)) { nm_log_err (LOGD_CORE, "failed to initialize: %s", error->message); goto done; } @@ -448,16 +441,15 @@ done: * state here. We don't bother updating the state as devices * change during regular operation. If NM is killed with SIGKILL, * it misses to update the state. */ - nm_manager_write_device_state (nm_manager_get ()); - - nm_exported_object_class_set_quitting (); + nm_manager_write_device_state (manager); - nm_manager_stop (nm_manager_get ()); + nm_manager_stop (manager); nm_config_state_set (config, TRUE, TRUE); nm_dns_manager_stop (nm_dns_manager_get ()); +done_no_manager: if (global_opt.pidfile && wrote_pidfile) unlink (global_opt.pidfile); -- cgit 1.3.0-6-gf8a5