Re: PATCH: prevent repeated reconnections with some chipsets



Seen this issue, reworked the patch last night for 0.6.5. I think its complete. Will test this week.

Mark Stosberg wrote:
When NetworkManager 0.6.3 is used with certain chipsets, repeated
reconnections happen, making some kinds of network use impossible, like
SSH.
A specific issue with identified and a patch was made to address this.

The details are all in this bug report, including a link the Ubuntu bug
report, which has the patch.
http://bugzilla.gnome.org/show_bug.cgi?id=418065

A number of other users have been affected this, and attention is
appreciated.
Personally, I can say that things have been great for me after a week of
usage with the patch in place-- no problems.
I could publish the rebuilt Ubuntu/Edgy pages I built with the patch if
there is interest.
   Mark


_______________________________________________
NetworkManager-list mailing list
NetworkManager-list gnome org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


diff -ur NetworkManager-0.6.5.orig/src/NetworkManager.c NetworkManager-0.6.5/src/NetworkManager.c
--- NetworkManager-0.6.5.orig/src/NetworkManager.c	2007-04-01 08:07:38.000000000 +0200
+++ NetworkManager-0.6.5/src/NetworkManager.c	2007-04-01 08:12:11.000000000 +0200
@@ -477,6 +477,7 @@
 
 	data->enable_test_devices = enable_test_devices;
 	data->wireless_enabled = TRUE;
+	data->reconn_timeout = 8000;
 	return data;
 }
 
Only in NetworkManager-0.6.5/src: NetworkManager.c.orig
Only in NetworkManager-0.6.5/src: NetworkManager.c.rej
diff -ur NetworkManager-0.6.5.orig/src/NetworkManagerMain.h NetworkManager-0.6.5/src/NetworkManagerMain.h
--- NetworkManager-0.6.5.orig/src/NetworkManagerMain.h	2007-04-01 08:07:38.000000000 +0200
+++ NetworkManager-0.6.5/src/NetworkManagerMain.h	2007-04-01 08:09:00.000000000 +0200
@@ -87,6 +87,8 @@
 	gboolean				asleep;
 	gboolean				disconnected;
 
+	int             reconn_timeout;
+
 	GSList *				dialup_list;
 	GMutex *				dialup_list_mutex;
 
Only in NetworkManager-0.6.5/src: NetworkManagerMain.h.orig
Only in NetworkManager-0.6.5/src: NetworkManagerMain.h.rej
diff -ur NetworkManager-0.6.5.orig/src/nm-dbus-nm.c NetworkManager-0.6.5/src/nm-dbus-nm.c
--- NetworkManager-0.6.5.orig/src/nm-dbus-nm.c	2007-04-01 08:07:38.000000000 +0200
+++ NetworkManager-0.6.5/src/nm-dbus-nm.c	2007-04-01 08:07:43.000000000 +0200
@@ -643,6 +643,25 @@
 	return NULL;
 }
 
+static DBusMessage *nm_dbus_nm_reconn_timeout (DBusConnection *connection, DBusMessage *message, NMDbusCBData *data)
+{
+	NMData	*app_data;
+	DBusMessageIter	iter;
+	DBusError	err;
+  guint timeout;
+
+	g_return_val_if_fail (data && data->data && connection && message, NULL);
+
+	dbus_error_init (&err);
+	if (!dbus_message_get_args (message, &err, DBUS_TYPE_INT32, &timeout, DBUS_TYPE_INVALID))
+		return NULL;
+
+	nm_info  ("Setting reconnection timeout to %i msec", timeout);
+	data->data->reconn_timeout = timeout;
+
+	return NULL;
+}
+
 static DBusMessage *nm_dbus_nm_get_state (DBusConnection *connection, DBusMessage *message, NMDbusCBData *data)
 {
 	DBusMessage *	reply = NULL;
@@ -678,6 +697,7 @@
 	nm_dbus_method_list_add_method (list, "getWirelessEnabled",		nm_dbus_nm_get_wireless_enabled);
 	nm_dbus_method_list_add_method (list, "sleep",				nm_dbus_nm_sleep);
 	nm_dbus_method_list_add_method (list, "wake",				nm_dbus_nm_wake);
+	nm_dbus_method_list_add_method (list, "reconnTimeout", nm_dbus_nm_reconn_timeout);
 	nm_dbus_method_list_add_method (list, "state",				nm_dbus_nm_get_state);
 	nm_dbus_method_list_add_method (list, "createTestDevice",		nm_dbus_nm_create_test_device);
 	nm_dbus_method_list_add_method (list, "removeTestDevice",		nm_dbus_nm_remove_test_device);
Only in NetworkManager-0.6.5/src: nm-dbus-nm.c.orig
diff -ur NetworkManager-0.6.5.orig/src/nm-device-802-11-wireless.c NetworkManager-0.6.5/src/nm-device-802-11-wireless.c
--- NetworkManager-0.6.5.orig/src/nm-device-802-11-wireless.c	2007-04-01 08:07:38.000000000 +0200
+++ NetworkManager-0.6.5/src/nm-device-802-11-wireless.c	2007-04-01 08:07:43.000000000 +0200
@@ -2625,6 +2625,7 @@
 {
 	NMDevice *			dev = NM_DEVICE (user_data);
 	NMDevice80211Wireless *	self = NM_DEVICE_802_11_WIRELESS (user_data);
+  NMData *      app_data = nm_device_get_app_data (dev);
 	char *				message;
 	size_t				len;
 	struct wpa_ctrl *		ctrl;
Only in NetworkManager-0.6.5/src: nm-device-802-11-wireless.c.orig
Only in NetworkManager-0.6.5/src: nm-device-802-11-wireless.c.rej
diff -ur NetworkManager-0.6.5.orig/test/nm-tool.c NetworkManager-0.6.5/test/nm-tool.c
--- NetworkManager-0.6.5.orig/test/nm-tool.c	2007-04-01 08:07:38.000000000 +0200
+++ NetworkManager-0.6.5/test/nm-tool.c	2007-04-01 08:07:43.000000000 +0200
@@ -407,6 +407,24 @@
 	dbus_message_unref (reply);
 }
 
+static gboolean set_nm_timeout (DBusConnection *connection, int timeout)
+{
+	gboolean		success = TRUE;
+	DBusMessage *	message = NULL;
+
+	if (!(message = dbus_message_new_method_call (NM_DBUS_SERVICE, NM_DBUS_PATH, NM_DBUS_INTERFACE, "reconnTimeout")))
+	{
+		fprintf (stderr, "set_nm_timeout(): couldn't create new dbus message.\n");
+		return FALSE;
+	}
+
+  /* Build up the required args */
+  dbus_message_append_args (message, DBUS_TYPE_INT32, &timeout, DBUS_TYPE_INVALID);
+  dbus_connection_send (connection, message, NULL);
+  printf (" message sent\n");
+
+	return success;
+}
 
 static void print_devices (DBusConnection *connection)
 {
@@ -458,6 +476,9 @@
 {
 	DBusConnection *connection;
 	DBusError		error;
+  gboolean    stats = FALSE;
+  gboolean    help = FALSE;
+  int         set_timeout = 0;
 
 	g_type_init ();
 
@@ -470,15 +491,41 @@
 		return 1;
 	}
 
-	printf ("\nNetworkManager Tool\n\n");
-
-	if (!get_nm_state (connection))
-	{
-		fprintf (stderr, "\n\nNetworkManager appears not to be running (could not get its state).\n");
-		exit (1);
-	}
-
-	print_devices (connection);
+  /* Parse options */
+  {
+    GOptionContext  *opt_ctx = NULL;
+    GOptionEntry options[] = {
+      {"stats", 0, 0, G_OPTION_ARG_NONE, &stats, "Show statistics about the active Network", NULL},
+      {"set-timeout", 0, 0, G_OPTION_ARG_INT, &set_timeout, "set NM reconnection timeout for link loss", NULL},
+      {"help", 0, 0, G_OPTION_ARG_NONE, &help, "show this help", NULL},
+      {NULL}
+    };
+    opt_ctx = g_option_context_new("");
+    g_option_context_add_main_entries(opt_ctx, options, NULL);
+    g_option_context_parse(opt_ctx, &argc, &argv, NULL);
+    g_option_context_free(opt_ctx);
+  }
+
+ 	if (!get_nm_state (connection))
+ 	{
+ 		fprintf (stderr, "\n\nNetworkManager appears not to be running (could not get its state).\n");
+ 		exit (1);
+ 	}
+
+  if (set_timeout != 0)
+  {
+  	printf ("\nSetting reconnection timeout to %i ms ...", set_timeout);
+    set_nm_timeout(connection, set_timeout);
+    exit (EXIT_SUCCESS);
+  }
+
+  if (stats == TRUE)
+  {
+  	printf ("\nNetworkManager Tool\n\n");
+  
+  	print_devices (connection);
+    exit (EXIT_SUCCESS);
+  }
 
 	return 0;
 }


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