5 * Copyright (C) 2007-2013 Intel Corporation. All rights reserved.
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License version 2 as
9 * published by the Free Software Foundation.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
32 #include <sys/signalfd.h>
38 #include <sys/resource.h>
44 #define CONF_ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0]) - 1)
46 #define DEFAULT_INPUT_REQUEST_TIMEOUT (120 * 1000)
47 #define DEFAULT_BROWSER_LAUNCH_TIMEOUT (300 * 1000)
49 #define MAINFILE "main.conf"
50 #define CONFIGMAINFILE CONFIGDIR "/" MAINFILE
52 static char *default_auto_connect[] = {
59 static char *default_favorite_techs[] = {
64 static char *default_blacklist[] = {
76 char **pref_timeservers;
77 unsigned int *auto_connect;
78 unsigned int *favorite_techs;
79 unsigned int *preferred_techs;
80 unsigned int *always_connected_techs;
81 char **fallback_nameservers;
82 unsigned int timeout_inputreq;
83 unsigned int timeout_browserlaunch;
84 char **blacklisted_interfaces;
85 bool allow_hostname_updates;
86 bool allow_domainname_updates;
88 char **tethering_technologies;
89 bool persistent_tethering_mode;
91 char *vendor_class_id;
92 bool enable_online_check;
93 bool auto_connect_roaming_services;
95 bool use_gateways_as_timeservers;
97 char **cellular_interfaces;
98 bool tizen_tv_extension;
100 } connman_settings = {
102 .pref_timeservers = NULL,
103 .auto_connect = NULL,
104 .favorite_techs = NULL,
105 .preferred_techs = NULL,
106 .always_connected_techs = NULL,
107 .fallback_nameservers = NULL,
108 .timeout_inputreq = DEFAULT_INPUT_REQUEST_TIMEOUT,
109 .timeout_browserlaunch = DEFAULT_BROWSER_LAUNCH_TIMEOUT,
110 .blacklisted_interfaces = NULL,
111 .allow_hostname_updates = true,
112 .allow_domainname_updates = true,
113 .single_tech = false,
114 .tethering_technologies = NULL,
115 .persistent_tethering_mode = false,
116 .enable_6to4 = false,
117 .vendor_class_id = NULL,
118 .enable_online_check = true,
119 .auto_connect_roaming_services = false,
121 .use_gateways_as_timeservers = false,
122 #if defined TIZEN_EXT
123 .cellular_interfaces = NULL,
124 .tizen_tv_extension = false,
128 #define CONF_BG_SCAN "BackgroundScanning"
129 #define CONF_PREF_TIMESERVERS "FallbackTimeservers"
130 #define CONF_AUTO_CONNECT_TECHS "DefaultAutoConnectTechnologies"
131 #define CONF_FAVORITE_TECHS "DefaultFavoriteTechnologies"
132 #define CONF_ALWAYS_CONNECTED_TECHS "AlwaysConnectedTechnologies"
133 #define CONF_PREFERRED_TECHS "PreferredTechnologies"
134 #define CONF_FALLBACK_NAMESERVERS "FallbackNameservers"
135 #define CONF_TIMEOUT_INPUTREQ "InputRequestTimeout"
136 #define CONF_TIMEOUT_BROWSERLAUNCH "BrowserLaunchTimeout"
137 #define CONF_BLACKLISTED_INTERFACES "NetworkInterfaceBlacklist"
138 #define CONF_ALLOW_HOSTNAME_UPDATES "AllowHostnameUpdates"
139 #define CONF_ALLOW_DOMAINNAME_UPDATES "AllowDomainnameUpdates"
140 #define CONF_SINGLE_TECH "SingleConnectedTechnology"
141 #define CONF_TETHERING_TECHNOLOGIES "TetheringTechnologies"
142 #define CONF_PERSISTENT_TETHERING_MODE "PersistentTetheringMode"
143 #define CONF_ENABLE_6TO4 "Enable6to4"
144 #define CONF_VENDOR_CLASS_ID "VendorClassID"
145 #define CONF_ENABLE_ONLINE_CHECK "EnableOnlineCheck"
146 #define CONF_AUTO_CONNECT_ROAMING_SERVICES "AutoConnectRoamingServices"
147 #define CONF_ACD "AddressConflictDetection"
148 #define CONF_USE_GATEWAYS_AS_TIMESERVERS "UseGatewaysAsTimeservers"
149 #if defined TIZEN_EXT
150 #define CONF_CELLULAR_INTERFACE "NetworkCellularInterfaceList"
151 #define CONF_TIZEN_TV_EXT "TizenTVExtension"
154 static const char *supported_options[] = {
156 CONF_PREF_TIMESERVERS,
157 CONF_AUTO_CONNECT_TECHS,
158 CONF_ALWAYS_CONNECTED_TECHS,
159 CONF_PREFERRED_TECHS,
160 CONF_FALLBACK_NAMESERVERS,
161 CONF_TIMEOUT_INPUTREQ,
162 CONF_TIMEOUT_BROWSERLAUNCH,
163 CONF_BLACKLISTED_INTERFACES,
164 CONF_ALLOW_HOSTNAME_UPDATES,
165 CONF_ALLOW_DOMAINNAME_UPDATES,
167 CONF_TETHERING_TECHNOLOGIES,
168 CONF_PERSISTENT_TETHERING_MODE,
170 CONF_VENDOR_CLASS_ID,
171 CONF_ENABLE_ONLINE_CHECK,
172 CONF_AUTO_CONNECT_ROAMING_SERVICES,
174 CONF_USE_GATEWAYS_AS_TIMESERVERS,
175 #if defined TIZEN_EXT
176 CONF_CELLULAR_INTERFACE,
182 static GKeyFile *load_config(const char *file)
187 keyfile = g_key_file_new();
189 g_key_file_set_list_separator(keyfile, ',');
191 if (!g_key_file_load_from_file(keyfile, file, 0, &err)) {
192 if (err->code != G_FILE_ERROR_NOENT) {
193 connman_error("Parsing %s failed: %s", file,
198 g_key_file_free(keyfile);
205 static uint *parse_service_types(char **str_list, gsize len)
207 unsigned int *type_list;
209 enum connman_service_type type;
211 type_list = g_try_new0(unsigned int, len + 1);
217 while (str_list[i]) {
218 type = __connman_service_string2type(str_list[i]);
220 if (type != CONNMAN_SERVICE_TYPE_UNKNOWN) {
227 type_list[j] = CONNMAN_SERVICE_TYPE_UNKNOWN;
232 static char **parse_fallback_nameservers(char **nameservers, gsize len)
237 servers = g_try_new0(char *, len + 1);
243 while (nameservers[i]) {
244 if (connman_inet_check_ipaddress(nameservers[i]) > 0) {
245 servers[j] = g_strdup(nameservers[i]);
254 static void check_config(GKeyFile *config)
262 keys = g_key_file_get_groups(config, NULL);
264 for (j = 0; keys && keys[j]; j++) {
265 if (g_strcmp0(keys[j], "General") != 0)
266 connman_warn("Unknown group %s in %s",
272 keys = g_key_file_get_keys(config, "General", NULL, NULL);
274 for (j = 0; keys && keys[j]; j++) {
279 for (i = 0; supported_options[i]; i++) {
280 if (g_strcmp0(keys[j], supported_options[i]) == 0) {
285 if (!found && !supported_options[i])
286 connman_warn("Unknown option %s in %s",
293 #if defined TIZEN_EXT
294 static void check_Tizen_configuration(GKeyFile *config)
296 GError *error = NULL;
297 char **cellular_interfaces;
301 cellular_interfaces = g_key_file_get_string_list(config, "General",
302 CONF_CELLULAR_INTERFACE, &len, &error);
305 connman_settings.cellular_interfaces = cellular_interfaces;
307 g_clear_error(&error);
309 boolean = __connman_config_get_bool(config, "General",
310 CONF_TIZEN_TV_EXT, &error);
312 connman_settings.tizen_tv_extension = boolean;
314 g_clear_error(&error);
317 static void set_nofile_inc(void)
322 rlim.rlim_cur = 8192;
323 rlim.rlim_max = 8192;
325 err = setrlimit(RLIMIT_NOFILE, &rlim);
327 DBG("fail to increase FILENO err(%d)", err);
333 static void parse_config(GKeyFile *config)
335 GError *error = NULL;
341 char *vendor_class_id;
346 connman_settings.auto_connect =
347 parse_service_types(default_auto_connect, CONF_ARRAY_SIZE(default_auto_connect));
348 connman_settings.favorite_techs =
349 parse_service_types(default_favorite_techs, CONF_ARRAY_SIZE(default_favorite_techs));
350 connman_settings.blacklisted_interfaces =
351 g_strdupv(default_blacklist);
355 DBG("parsing %s", MAINFILE);
357 boolean = g_key_file_get_boolean(config, "General",
358 CONF_BG_SCAN, &error);
360 connman_settings.bg_scan = boolean;
362 g_clear_error(&error);
364 timeservers = __connman_config_get_string_list(config, "General",
365 CONF_PREF_TIMESERVERS, NULL, &error);
367 connman_settings.pref_timeservers = timeservers;
369 g_clear_error(&error);
371 str_list = __connman_config_get_string_list(config, "General",
372 CONF_AUTO_CONNECT_TECHS, &len, &error);
375 connman_settings.auto_connect =
376 parse_service_types(str_list, len);
378 connman_settings.auto_connect =
379 parse_service_types(default_auto_connect, CONF_ARRAY_SIZE(default_auto_connect));
381 g_clear_error(&error);
383 str_list = __connman_config_get_string_list(config, "General",
384 CONF_FAVORITE_TECHS, &len, &error);
387 connman_settings.favorite_techs =
388 parse_service_types(str_list, len);
390 connman_settings.favorite_techs =
391 parse_service_types(default_favorite_techs, CONF_ARRAY_SIZE(default_favorite_techs));
393 g_strfreev(str_list);
395 g_clear_error(&error);
397 str_list = __connman_config_get_string_list(config, "General",
398 CONF_PREFERRED_TECHS, &len, &error);
401 connman_settings.preferred_techs =
402 parse_service_types(str_list, len);
404 g_strfreev(str_list);
406 g_clear_error(&error);
408 str_list = __connman_config_get_string_list(config, "General",
409 CONF_ALWAYS_CONNECTED_TECHS, &len, &error);
412 connman_settings.always_connected_techs =
413 parse_service_types(str_list, len);
415 g_strfreev(str_list);
417 g_clear_error(&error);
419 str_list = __connman_config_get_string_list(config, "General",
420 CONF_FALLBACK_NAMESERVERS, &len, &error);
423 connman_settings.fallback_nameservers =
424 parse_fallback_nameservers(str_list, len);
426 g_strfreev(str_list);
428 g_clear_error(&error);
430 timeout = g_key_file_get_integer(config, "General",
431 CONF_TIMEOUT_INPUTREQ, &error);
432 if (!error && timeout >= 0)
433 connman_settings.timeout_inputreq = timeout * 1000;
435 g_clear_error(&error);
437 timeout = g_key_file_get_integer(config, "General",
438 CONF_TIMEOUT_BROWSERLAUNCH, &error);
439 if (!error && timeout >= 0)
440 connman_settings.timeout_browserlaunch = timeout * 1000;
442 g_clear_error(&error);
444 interfaces = __connman_config_get_string_list(config, "General",
445 CONF_BLACKLISTED_INTERFACES, &len, &error);
448 connman_settings.blacklisted_interfaces = interfaces;
450 connman_settings.blacklisted_interfaces =
451 g_strdupv(default_blacklist);
453 g_clear_error(&error);
455 boolean = __connman_config_get_bool(config, "General",
456 CONF_ALLOW_HOSTNAME_UPDATES,
459 connman_settings.allow_hostname_updates = boolean;
461 g_clear_error(&error);
463 boolean = __connman_config_get_bool(config, "General",
464 CONF_ALLOW_DOMAINNAME_UPDATES,
467 connman_settings.allow_domainname_updates = boolean;
469 g_clear_error(&error);
471 boolean = __connman_config_get_bool(config, "General",
472 CONF_SINGLE_TECH, &error);
474 connman_settings.single_tech = boolean;
476 g_clear_error(&error);
478 tethering = __connman_config_get_string_list(config, "General",
479 CONF_TETHERING_TECHNOLOGIES, &len, &error);
482 connman_settings.tethering_technologies = tethering;
484 g_clear_error(&error);
486 boolean = __connman_config_get_bool(config, "General",
487 CONF_PERSISTENT_TETHERING_MODE,
490 connman_settings.persistent_tethering_mode = boolean;
492 g_clear_error(&error);
494 boolean = __connman_config_get_bool(config, "General",
495 CONF_ENABLE_6TO4, &error);
497 connman_settings.enable_6to4 = boolean;
499 g_clear_error(&error);
501 vendor_class_id = __connman_config_get_string(config, "General",
502 CONF_VENDOR_CLASS_ID, &error);
504 connman_settings.vendor_class_id = vendor_class_id;
506 g_clear_error(&error);
508 boolean = __connman_config_get_bool(config, "General",
509 CONF_ENABLE_ONLINE_CHECK, &error);
511 connman_settings.enable_online_check = boolean;
513 connman_info("Online check disabled by main config.");
516 g_clear_error(&error);
518 boolean = __connman_config_get_bool(config, "General",
519 CONF_AUTO_CONNECT_ROAMING_SERVICES, &error);
521 connman_settings.auto_connect_roaming_services = boolean;
523 g_clear_error(&error);
525 boolean = __connman_config_get_bool(config, "General", CONF_ACD, &error);
527 connman_settings.acd = boolean;
529 g_clear_error(&error);
531 boolean = __connman_config_get_bool(config, "General",
532 CONF_USE_GATEWAYS_AS_TIMESERVERS, &error);
534 connman_settings.use_gateways_as_timeservers = boolean;
536 g_clear_error(&error);
538 #if defined TIZEN_EXT
539 check_Tizen_configuration(config);
543 static int config_init(const char *file)
547 #if defined TIZEN_EXT
550 config = load_config(file);
551 check_config(config);
552 parse_config(config);
554 g_key_file_free(config);
559 static GMainLoop *main_loop = NULL;
561 static unsigned int __terminated = 0;
563 static gboolean signal_handler(GIOChannel *channel, GIOCondition cond,
566 struct signalfd_siginfo si;
570 if (cond & (G_IO_NVAL | G_IO_ERR | G_IO_HUP))
573 fd = g_io_channel_unix_get_fd(channel);
575 result = read(fd, &si, sizeof(si));
576 if (result != sizeof(si))
579 switch (si.ssi_signo) {
582 if (__terminated == 0) {
583 connman_info("Terminating");
584 g_main_loop_quit(main_loop);
594 static guint setup_signalfd(void)
602 sigaddset(&mask, SIGINT);
603 sigaddset(&mask, SIGTERM);
605 if (sigprocmask(SIG_BLOCK, &mask, NULL) < 0) {
606 perror("Failed to set signal mask");
610 fd = signalfd(-1, &mask, 0);
612 perror("Failed to create signal descriptor");
616 channel = g_io_channel_unix_new(fd);
618 g_io_channel_set_close_on_unref(channel, TRUE);
619 g_io_channel_set_encoding(channel, NULL, NULL);
620 g_io_channel_set_buffered(channel, FALSE);
622 source = g_io_add_watch(channel,
623 G_IO_IN | G_IO_HUP | G_IO_ERR | G_IO_NVAL,
624 signal_handler, NULL);
626 g_io_channel_unref(channel);
631 static void disconnect_callback(DBusConnection *conn, void *user_data)
633 connman_error("D-Bus disconnect");
635 g_main_loop_quit(main_loop);
638 static gchar *option_config = NULL;
639 static gchar *option_debug = NULL;
640 static gchar *option_device = NULL;
641 static gchar *option_plugin = NULL;
642 static gchar *option_nodevice = NULL;
643 static gchar *option_noplugin = NULL;
644 static gchar *option_wifi = NULL;
645 static gboolean option_detach = TRUE;
646 static gboolean option_dnsproxy = TRUE;
647 static gboolean option_backtrace = TRUE;
648 static gboolean option_version = FALSE;
650 static bool parse_debug(const char *key, const char *value,
651 gpointer user_data, GError **error)
655 char *prev = option_debug;
657 option_debug = g_strconcat(prev, ",", value, NULL);
660 option_debug = g_strdup(value);
663 g_free(option_debug);
664 option_debug = g_strdup("*");
670 static bool parse_noplugin(const char *key, const char *value,
671 gpointer user_data, GError **error)
673 if (option_noplugin) {
674 char *prev = option_noplugin;
676 option_noplugin = g_strconcat(prev, ",", value, NULL);
679 option_noplugin = g_strdup(value);
685 static GOptionEntry options[] = {
686 { "config", 'c', 0, G_OPTION_ARG_STRING, &option_config,
687 "Load the specified configuration file "
688 "instead of " CONFIGMAINFILE, "FILE" },
689 { "debug", 'd', G_OPTION_FLAG_OPTIONAL_ARG,
690 G_OPTION_ARG_CALLBACK, parse_debug,
691 "Specify debug options to enable", "DEBUG" },
692 { "device", 'i', 0, G_OPTION_ARG_STRING, &option_device,
693 "Specify networking devices or interfaces", "DEV,..." },
694 { "nodevice", 'I', 0, G_OPTION_ARG_STRING, &option_nodevice,
695 "Specify networking interfaces to ignore", "DEV,..." },
696 { "plugin", 'p', 0, G_OPTION_ARG_STRING, &option_plugin,
697 "Specify plugins to load", "NAME,..." },
698 { "noplugin", 'P', 0, G_OPTION_ARG_CALLBACK, &parse_noplugin,
699 "Specify plugins not to load", "NAME,..." },
700 { "wifi", 'W', 0, G_OPTION_ARG_STRING, &option_wifi,
701 "Specify driver for WiFi/Supplicant", "NAME" },
702 { "nodaemon", 'n', G_OPTION_FLAG_REVERSE,
703 G_OPTION_ARG_NONE, &option_detach,
704 "Don't fork daemon to background" },
705 { "nodnsproxy", 'r', G_OPTION_FLAG_REVERSE,
706 G_OPTION_ARG_NONE, &option_dnsproxy,
707 "Don't support DNS resolving" },
708 { "nobacktrace", 0, G_OPTION_FLAG_REVERSE,
709 G_OPTION_ARG_NONE, &option_backtrace,
710 "Don't print out backtrace information" },
711 { "version", 'v', 0, G_OPTION_ARG_NONE, &option_version,
712 "Show version information and exit" },
716 const char *connman_option_get_string(const char *key)
718 if (g_str_equal(key, CONF_VENDOR_CLASS_ID))
719 return connman_settings.vendor_class_id;
721 if (g_strcmp0(key, "wifi") == 0) {
723 return "nl80211,wext";
731 bool connman_setting_get_bool(const char *key)
733 if (g_str_equal(key, CONF_BG_SCAN))
734 return connman_settings.bg_scan;
736 if (g_str_equal(key, CONF_ALLOW_HOSTNAME_UPDATES))
737 return connman_settings.allow_hostname_updates;
739 if (g_str_equal(key, CONF_ALLOW_DOMAINNAME_UPDATES))
740 return connman_settings.allow_domainname_updates;
742 if (g_str_equal(key, CONF_SINGLE_TECH))
743 return connman_settings.single_tech;
745 if (g_str_equal(key, CONF_PERSISTENT_TETHERING_MODE))
746 return connman_settings.persistent_tethering_mode;
748 if (g_str_equal(key, CONF_ENABLE_6TO4))
749 return connman_settings.enable_6to4;
751 if (g_str_equal(key, CONF_ENABLE_ONLINE_CHECK))
752 return connman_settings.enable_online_check;
754 if (g_str_equal(key, CONF_AUTO_CONNECT_ROAMING_SERVICES))
755 return connman_settings.auto_connect_roaming_services;
757 if (g_str_equal(key, CONF_ACD))
758 return connman_settings.acd;
760 if (g_str_equal(key, CONF_USE_GATEWAYS_AS_TIMESERVERS))
761 return connman_settings.use_gateways_as_timeservers;
766 char **connman_setting_get_string_list(const char *key)
768 if (g_str_equal(key, CONF_PREF_TIMESERVERS))
769 return connman_settings.pref_timeservers;
771 if (g_str_equal(key, CONF_FALLBACK_NAMESERVERS))
772 return connman_settings.fallback_nameservers;
774 if (g_str_equal(key, CONF_BLACKLISTED_INTERFACES))
775 return connman_settings.blacklisted_interfaces;
777 if (g_str_equal(key, CONF_TETHERING_TECHNOLOGIES))
778 return connman_settings.tethering_technologies;
780 #if defined TIZEN_EXT
781 if (g_str_equal(key, CONF_CELLULAR_INTERFACE))
782 return connman_settings.cellular_interfaces;
788 unsigned int *connman_setting_get_uint_list(const char *key)
790 if (g_str_equal(key, CONF_AUTO_CONNECT_TECHS))
791 return connman_settings.auto_connect;
793 if (g_str_equal(key, CONF_FAVORITE_TECHS))
794 return connman_settings.favorite_techs;
796 if (g_str_equal(key, CONF_PREFERRED_TECHS))
797 return connman_settings.preferred_techs;
799 if (g_str_equal(key, CONF_ALWAYS_CONNECTED_TECHS))
800 return connman_settings.always_connected_techs;
805 unsigned int connman_timeout_input_request(void)
807 return connman_settings.timeout_inputreq;
810 unsigned int connman_timeout_browser_launch(void)
812 return connman_settings.timeout_browserlaunch;
815 int main(int argc, char *argv[])
817 GOptionContext *context;
818 GError *error = NULL;
819 DBusConnection *conn;
823 context = g_option_context_new(NULL);
824 g_option_context_add_main_entries(context, options, NULL);
826 if (!g_option_context_parse(context, &argc, &argv, &error)) {
828 g_printerr("%s\n", error->message);
831 g_printerr("An unknown error occurred\n");
835 g_option_context_free(context);
837 if (option_version) {
838 printf("%s\n", VERSION);
844 perror("Can't start daemon");
849 if (mkdir(STORAGEDIR, S_IRUSR | S_IWUSR | S_IXUSR |
850 S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH) < 0) {
852 perror("Failed to create storage directory");
857 main_loop = g_main_loop_new(NULL, FALSE);
859 signal = setup_signalfd();
861 dbus_error_init(&err);
863 conn = g_dbus_setup_bus(DBUS_BUS_SYSTEM, CONNMAN_SERVICE, &err);
865 if (dbus_error_is_set(&err)) {
866 fprintf(stderr, "%s\n", err.message);
867 dbus_error_free(&err);
869 fprintf(stderr, "Can't register with system bus\n");
873 g_dbus_set_disconnect_function(conn, disconnect_callback, NULL, NULL);
875 __connman_log_init(argv[0], option_debug, option_detach,
876 option_backtrace, "Connection Manager", VERSION);
878 __connman_dbus_init(conn);
881 config_init(CONFIGMAINFILE);
883 config_init(option_config);
885 __connman_util_init();
886 __connman_inotify_init();
887 __connman_technology_init();
888 __connman_notifier_init();
889 __connman_agent_init();
890 __connman_service_init();
891 __connman_peer_service_init();
892 __connman_peer_init();
893 #if defined TIZEN_EXT_WIFI_MESH
894 __connman_mesh_init();
895 #endif /* TIZEN_EXT_WIFI_MESH */
896 __connman_provider_init();
897 __connman_network_init();
898 __connman_config_init();
899 __connman_device_init(option_device, option_nodevice);
901 __connman_ippool_init();
902 __connman_firewall_init();
903 __connman_nat_init();
904 __connman_tethering_init();
905 __connman_counter_init();
906 __connman_manager_init();
907 __connman_stats_init();
908 __connman_clock_init();
910 __connman_ipconfig_init();
911 __connman_rtnl_init();
912 __connman_task_init();
913 __connman_proxy_init();
914 __connman_detect_init();
915 __connman_session_init();
916 __connman_timeserver_init();
917 __connman_connection_init();
919 __connman_plugin_init(option_plugin, option_noplugin);
921 __connman_resolver_init(option_dnsproxy);
922 __connman_rtnl_start();
923 __connman_dhcp_init();
924 __connman_dhcpv6_init();
925 __connman_wpad_init();
926 __connman_wispr_init();
927 #if !defined TIZEN_EXT
928 __connman_rfkill_init();
929 __connman_machine_init();
932 g_free(option_config);
933 g_free(option_device);
934 g_free(option_plugin);
935 g_free(option_nodevice);
936 g_free(option_noplugin);
938 g_main_loop_run(main_loop);
940 g_source_remove(signal);
942 #if !defined TIZEN_EXT
943 __connman_machine_cleanup();
944 __connman_rfkill_cleanup();
946 __connman_wispr_cleanup();
947 __connman_wpad_cleanup();
948 __connman_dhcpv6_cleanup();
949 __connman_session_cleanup();
950 __connman_plugin_cleanup();
951 __connman_provider_cleanup();
952 __connman_connection_cleanup();
953 __connman_timeserver_cleanup();
954 __connman_detect_cleanup();
955 __connman_proxy_cleanup();
956 __connman_task_cleanup();
957 __connman_rtnl_cleanup();
958 __connman_resolver_cleanup();
960 __connman_clock_cleanup();
961 __connman_stats_cleanup();
962 __connman_config_cleanup();
963 __connman_manager_cleanup();
964 __connman_counter_cleanup();
965 __connman_tethering_cleanup();
966 __connman_nat_cleanup();
967 __connman_firewall_cleanup();
968 __connman_peer_service_cleanup();
969 __connman_peer_cleanup();
970 #if defined TIZEN_EXT_WIFI_MESH
971 __connman_mesh_cleanup();
972 #endif /* TIZEN_EXT_WIFI_MESH */
973 __connman_ippool_cleanup();
974 __connman_device_cleanup();
975 __connman_network_cleanup();
976 __connman_dhcp_cleanup();
977 __connman_service_cleanup();
978 __connman_agent_cleanup();
979 __connman_ipconfig_cleanup();
980 __connman_notifier_cleanup();
981 __connman_technology_cleanup();
982 __connman_inotify_cleanup();
984 __connman_util_cleanup();
985 __connman_dbus_cleanup();
987 __connman_log_cleanup(option_backtrace);
989 dbus_connection_unref(conn);
991 g_main_loop_unref(main_loop);
993 if (connman_settings.pref_timeservers)
994 g_strfreev(connman_settings.pref_timeservers);
996 g_free(connman_settings.auto_connect);
997 g_free(connman_settings.favorite_techs);
998 g_free(connman_settings.preferred_techs);
999 g_strfreev(connman_settings.fallback_nameservers);
1000 g_strfreev(connman_settings.blacklisted_interfaces);
1001 g_strfreev(connman_settings.tethering_technologies);
1003 g_free(option_debug);
1004 g_free(option_wifi);