[network-manager-pptp] ppp: add minimal debugging output to the ppp plugin



commit 5f7412feb7a2a8adac8086fb3f2ae8475290b9a7
Author: Dan Williams <dcbw redhat com>
Date:   Mon Oct 5 12:22:14 2009 -0700

    ppp: add minimal debugging output to the ppp plugin
    
    Port of NM commits:
    336e9b2ca069533dad3bf6f2fce88bd65eed0b25 (0.7.x)
    ad03c0020966920d5816672da4bab5b0827671b7 (master)

 src/nm-pptp-pppd-plugin.c |   54 +++++++++++++++++++++++++++++++-------------
 1 files changed, 38 insertions(+), 16 deletions(-)
---
diff --git a/src/nm-pptp-pppd-plugin.c b/src/nm-pptp-pppd-plugin.c
index 2f81046..537964e 100644
--- a/src/nm-pptp-pppd-plugin.c
+++ b/src/nm-pptp-pppd-plugin.c
@@ -2,7 +2,7 @@
 /* nm-pptp-service - pptp (and other pppd) integration with NetworkManager
  *
  * (C) 2007 - 2008 Novell, Inc.
- * (C) 2008 Red Hat, Inc.
+ * (C) 2008 - 2009 Red Hat, Inc.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -110,11 +110,16 @@ nm_phasechange (void *data, int arg)
 		break;
 	}
 
+	g_message ("nm-pptp-ppp-plugin: (%s): status %d / phase '%s'",
+	           __func__,
+	           ppp_status,
+	           ppp_phase);
+
 	if (ppp_status != NM_PPP_STATUS_UNKNOWN) {
 		dbus_g_proxy_call_no_reply (proxy, "SetState",
-							   G_TYPE_UINT, ppp_status,
-							   G_TYPE_INVALID,
-							   G_TYPE_INVALID);
+		                            G_TYPE_UINT, ppp_status,
+		                            G_TYPE_INVALID,
+		                            G_TYPE_INVALID);
 	}
 }
 
@@ -163,8 +168,10 @@ nm_ip_up (void *data, int arg)
 
 	g_return_if_fail (DBUS_IS_G_PROXY (proxy));
 
+	g_message ("nm-pptp-ppp-plugin: (%s): ip-up event", __func__);
+
 	if (!opts.ouraddr) {
-		g_warning ("Didn't receive an internal IP from pppd");
+		g_warning ("nm-pptp-ppp-plugin: (%s): didn't receive an internal IP from pppd!", __func__);
 		return;
 	}
 
@@ -213,9 +220,11 @@ nm_ip_up (void *data, int arg)
 	/* Default MTU to 1400, which is also what Windows XP/Vista use */
 	g_hash_table_insert (hash, NM_VPN_PLUGIN_IP4_CONFIG_MTU, uint_to_gvalue (1400));
 
+	g_message ("nm-pptp-ppp-plugin: (%s): sending Ip4Config to NetworkManager-pptp...", __func__);
+
 	dbus_g_proxy_call_no_reply (proxy, "SetIp4Config",
-						   DBUS_TYPE_G_MAP_OF_VARIANT, hash, G_TYPE_INVALID,
-						   G_TYPE_INVALID);
+	                            DBUS_TYPE_G_MAP_OF_VARIANT, hash, G_TYPE_INVALID,
+	                            G_TYPE_INVALID);
 
 	g_hash_table_destroy (hash);
 }
@@ -235,8 +244,8 @@ get_pap_check()
 static int
 get_credentials (char *username, char *password)
 {
-	char *my_username;
-	char *my_password;
+	char *my_username = NULL;
+	char *my_password = NULL;
 	size_t len;
 	GError *err = NULL;
 
@@ -247,19 +256,25 @@ get_credentials (char *username, char *password)
 
 	g_return_val_if_fail (DBUS_IS_G_PROXY (proxy), -1);
 
-	my_username = my_password = NULL;
+	g_message ("nm-pptp-ppp-plugin: (%s): passwd-hook, requesting credentials...", __func__);
+
 	dbus_g_proxy_call (proxy, "NeedSecrets", &err,
-				    G_TYPE_INVALID,
-				    G_TYPE_STRING, &my_username,
-				    G_TYPE_STRING, &my_password,
-				    G_TYPE_INVALID);
+	                   G_TYPE_INVALID,
+	                   G_TYPE_STRING, &my_username,
+	                   G_TYPE_STRING, &my_password,
+	                   G_TYPE_INVALID);
 
 	if (err) {
-		g_warning ("Could not get secrets: %s", err->message);
+		g_warning ("nm-pptp-ppp-plugin: (%s): could not get secrets: (%d) %s",
+		           __func__,
+		           err ? err->code : -1,
+		           err->message ? err->message : "(unknown)");
 		g_error_free (err);
 		return -1;
 	}
 
+	g_message ("nm-pptp-ppp-plugin: (%s): got credentials from NetworkManager-pptp", __func__);
+
 	if (my_username) {
 		len = strlen (my_username) + 1;
 		len = len < MAXNAMELEN ? len : MAXNAMELEN;
@@ -288,6 +303,8 @@ nm_exit_notify (void *data, int arg)
 {
 	g_return_if_fail (DBUS_IS_G_PROXY (proxy));
 
+	g_message ("nm-pptp-ppp-plugin: (%s): cleaning up", __func__);
+
 	g_object_unref (proxy);
 	proxy = NULL;
 }
@@ -300,9 +317,14 @@ plugin_init (void)
 
 	g_type_init ();
 
+	g_message ("nm-pptp-ppp-plugin: (%s): initializing", __func__);
+
 	bus = dbus_g_bus_get (DBUS_BUS_SYSTEM, &err);
 	if (!bus) {
-		g_warning ("Couldn't connect to system bus: %s", err->message);
+		g_warning ("nm-pptp-pppd-plugin: (%s): couldn't connect to system bus: (%d) %s",
+		           __func__,
+		           err ? err->code : -1,
+		           err && err->message ? err->message : "(unknown)");
 		g_error_free (err);
 		return -1;
 	}



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]