From 9ef10efa0905b22395987d99b26b8d5cbebd03ba Mon Sep 17 00:00:00 2001 From: Avesh Agarwal Date: Tue, 10 Dec 2013 15:23:59 -0500 Subject: [PATCH 18/20] Fixed various debug messages. --- src/nm-openswan-service.c | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/src/nm-openswan-service.c b/src/nm-openswan-service.c index f205c1d..fffd020 100644 --- a/src/nm-openswan-service.c +++ b/src/nm-openswan-service.c @@ -305,12 +305,12 @@ nm_openswan_start_openswan_binary (NMOPENSWANPlugin *plugin, GError **error) if (!g_spawn_async (NULL, (char **) openswan_argv->pdata, NULL, G_SPAWN_DO_NOT_REAP_CHILD, NULL, NULL, &pid, error)) { g_ptr_array_free (openswan_argv, TRUE); - g_warning ("openswan ipsec failed to start. error: '%s'", (*error)->message); + g_printf ("pluto failed to start. error: '%s'\n", (*error)->message); return -1; } g_ptr_array_free (openswan_argv, TRUE); - g_message ("openswan: ipsec started with pid %d", pid); + g_printf ("ipsec/pluto started with pid %d\n", pid); NM_OPENSWAN_PLUGIN_GET_PRIVATE (plugin)->pid = pid; g_child_watch_add(pid, (GChildWatchFunc) pluto_watch_cb, plugin); @@ -331,20 +331,19 @@ nm_openswan_start_openswan_binary (NMOPENSWANPlugin *plugin, GError **error) NULL, NULL, error)) { g_ptr_array_free (openswan_argv, TRUE); - g_warning ("openswan: ipsec auto failed to start. error: '%s'", (*error)->message); + g_printf ("ipsec auto add failed with error: '%s'\n", (*error)->message); return -1; } g_ptr_array_free (openswan_argv, TRUE); - g_message ("openswan: ipsec auto started with pid %d", pid_auto); + if(debug) + g_printf ("pluto auto started with pid %d\n", pid_auto); g_child_watch_add(pid_auto, (GChildWatchFunc) pluto_watch_cb, plugin); return stdin_fd; } - - static gint nm_openswan_start_openswan_connection (NMOPENSWANPlugin *plugin, GError **error) { @@ -382,15 +381,17 @@ nm_openswan_start_openswan_connection (NMOPENSWANPlugin *plugin, GError **error) NULL, NULL, error)) { g_ptr_array_free (openswan_argv, TRUE); - g_warning ("openswan: ipsec auto connection failed to start. error: '%s'", (*error)->message); + g_printf ("ipsec/pluto auto connection failed to start. error: '%s'\n", (*error)->message); return -1; } g_ptr_array_free (openswan_argv, TRUE); - sleep(3); + if(debug) + g_printf ("pluto up started with pid %d\n", pid); + g_child_watch_add(pid, (GChildWatchFunc) pluto_watch_cb, plugin); - g_message ("openswan: ipsec auto connection started with pid %d", pid); + //sleep(3); return stdin_fd; } @@ -408,7 +409,7 @@ write_config_option (int fd, const char *format, ...) g_print ("Config: %s", string); if ( write (fd, string, strlen (string)) == -1) { - g_warning ("nm-openswan: error in write_config_option"); + g_printf ("nm-openswan: error in write_config_option\n"); } g_free (string); @@ -521,7 +522,7 @@ write_one_property (const char *key, const char *value, gpointer user_data) /* ignored */ } else { /* Just ignore unknown properties */ - g_warning ("Don't know how to write property '%s' with type %s", + g_printf ("Don't know how to write property '%s' with type %s\n", (char *) key, g_type_name (type)); } } @@ -676,7 +677,7 @@ real_connect (NMVPNPlugin *plugin, if (openswan_fd < 0) goto out; - write_config_option (openswan_fd, "%s", nm_setting_vpn_get_secret (s_vpn, NM_OPENSWAN_XAUTH_PASSWORD)); + write_config_option (openswan_fd, "%s", nm_setting_vpn_get_secret (s_vpn, NM_OPENSWAN_XAUTH_PASSWORD)); close(openswan_fd); openswan_fd=-1; -- 1.8.3.1