[PATCH] Re: NM doesn't handle two networks with same AP MAC Address?



FYI, I think this patch (against 0.3) fixes this problem..  It looks
like the issue is an ordering issue and the fact that it's using
strncmp() to find the right AP.  This is why it works sometimes and
not others, it's order dependent.  If I have 'foo' before 'foo-a' the
it will always find 'foo' first because of the way the strncmp works.
I've added code to the AP check to make sure the following character
in the 'path' is either NULL or a slash.  This seems to fix the
problem for me.

Dan, can you apply this patch to 0_3, 0_4, and HEAD?  I've only
tested on 0_3.

Thanks,

-derek

diff -r -u build-wl1/src/nm-dbus-net.c build-wl2/src/nm-dbus-net.c
--- build-wl1/src/nm-dbus-net.c	2005-02-11 16:44:34.000000000 -0500
+++ build-wl2/src/nm-dbus-net.c	2005-07-01 17:53:58.000000000 -0400
@@ -51,10 +51,14 @@
 
 	while ((ap = nm_ap_list_iter_next (iter)))
 	{
+		int len;
 		snprintf (compare_path, 100, "%s/%s/Networks/%s", NM_DBUS_PATH_DEVICES,
 				nm_device_get_iface (dev), nm_ap_get_essid (ap));
-		if (strncmp (path, compare_path, strlen (compare_path)) == 0)
-			break;
+		len = strlen(compare_path);
+		if (strncmp (path, compare_path, len) == 0)
+			/* Differentiate between 'foo' and 'foo-a' */
+			if (path[len] == '\0' || path[len] == '/')
+				break;
 	}
 		
 	nm_ap_list_iter_free (iter);
-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord MIT EDU                        PGP key available


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