Re: NM not connecting on resume, ipw2200

2006-07-13 Thread Derek Atkins
Bill Moss [EMAIL PROTECTED] writes:

 Some recent patches to NM and ipw2200 should take care of the failure to 
 connect on resume from suspend.

 1. NM failed to set the essid to ANY but instead left the essid 
 unchanged when deactivating a wireless network. Consequently, when NM 
 resumed the essid still had its previous value. Dan applied patches at 
 HEAD 1.934 to fix this.

What file was changed?  Is/has this patch been backported to 0.6?
And would this affect madwifi as well?

-derek
-- 
   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
   [EMAIL PROTECTED]PGP key available
___
NetworkManager-list mailing list
NetworkManager-list@gnome.org
http://mail.gnome.org/mailman/listinfo/networkmanager-list


Re: NM not connecting on resume, ipw2200

2006-07-13 Thread Dan Williams
On Thu, 2006-07-13 at 09:40 -0400, Derek Atkins wrote:
 Bill Moss [EMAIL PROTECTED] writes:
 
  Some recent patches to NM and ipw2200 should take care of the failure to 
  connect on resume from suspend.
 
  1. NM failed to set the essid to ANY but instead left the essid 
  unchanged when deactivating a wireless network. Consequently, when NM 
  resumed the essid still had its previous value. Dan applied patches at 
  HEAD 1.934 to fix this.
 
 What file was changed?  Is/has this patch been backported to 0.6?
 And would this affect madwifi as well?

src/nm-device-802-11-wireless.c, revision 1.69 - 1.70

It doesn't appear to be in STABLE_06, patch against 0.6 attached.
Please test this out and see if there are problems.  I think I
originally didn't backport it to 0.6 because stuff was working fine, and
if not broken, why fix it.  So if this patch fixes any of your problems,
and doesn't present new ones, please let me know.

Dan

? nm-clear-settings.patch
? po/stamp-it
? vpn-daemons/vpnc/NetworkManager-vpnc-0.5.0
? vpn-daemons/vpnc/NetworkManager-vpnc-0.6.0
Index: src/nm-device-802-11-wireless.c
===
RCS file: /cvs/gnome/NetworkManager/src/nm-device-802-11-wireless.c,v
retrieving revision 1.60.2.15
diff -u -r1.60.2.15 nm-device-802-11-wireless.c
--- src/nm-device-802-11-wireless.c	20 Jun 2006 02:24:57 -	1.60.2.15
+++ src/nm-device-802-11-wireless.c	13 Jul 2006 16:13:46 -
@@ -131,9 +131,7 @@
 
 static void		remove_link_timeout (NMDevice80211Wireless *self);
 
-static void		nm_device_802_11_wireless_set_wep_enc_key (NMDevice80211Wireless *self,
-   const char *key,
-   int auth_method);
+static void		nm_device_802_11_wireless_disable_encryption (NMDevice80211Wireless *self);
 
 
 /*
@@ -522,6 +520,10 @@
 
 	supplicant_cleanup (self);
 	remove_link_timeout (self);
+
+	/* Clean up stuff, don't leave the card associated */
+	nm_device_802_11_wireless_set_essid (self, );
+	nm_device_802_11_wireless_disable_encryption (self);
 }
 
 
@@ -534,9 +536,6 @@
 	app_data = nm_device_get_app_data (dev);
 	g_assert (app_data);
 
-	/* Clean up stuff, don't leave the card associated */
-	nm_device_802_11_wireless_set_essid (self, );
-	nm_device_802_11_wireless_set_wep_enc_key (self, NULL, 0);
 	nm_device_802_11_wireless_set_mode (self, IW_MODE_INFRA);
 	nm_device_802_11_wireless_set_scan_interval (app_data, self, NM_WIRELESS_SCAN_INTERVAL_ACTIVE);
 }
@@ -1596,91 +1595,36 @@
 
 
 /*
- * nm_device_set_wep_enc_key
+ * nm_device_802_11_wireless_disable_encryption
  *
- * If a device is wireless, set the encryption key that it should use.
+ * Clear any encryption keys the device may have set.
  *
- * key:	encryption key to use, or NULL or  to disable encryption.
  */
 static void
-nm_device_802_11_wireless_set_wep_enc_key (NMDevice80211Wireless *self,
-   const char *key,
-   int auth_method)
+nm_device_802_11_wireless_disable_encryption (NMDevice80211Wireless *self)
 {
+	const char * iface = nm_device_get_iface (NM_DEVICE (self));
 	NMSock *		sk;
-	struct iwreq	wreq;
-	int			keylen;
-	unsigned char	safe_key[IW_ENCODING_TOKEN_MAX + 1];
-	gboolean		set_key = FALSE;
-	const char *	iface;
 
 	g_return_if_fail (self != NULL);
 
-	/* Make sure the essid we get passed is a valid size */
-	if (!key)
-		safe_key[0] = '\0';
-	else
-	{
-		strncpy ((char *) safe_key, key, IW_ENCODING_TOKEN_MAX);
-		safe_key[IW_ENCODING_TOKEN_MAX] = '\0';
-	}
-
-	iface = nm_device_get_iface (NM_DEVICE (self));
 	if ((sk = nm_dev_sock_open (NM_DEVICE (self), DEV_WIRELESS, __FUNCTION__, NULL)))
 	{
-		wreq.u.data.pointer = (caddr_t) NULL;
-		wreq.u.data.length = 0;
-		wreq.u.data.flags = IW_ENCODE_ENABLED;
-
-		/* Unfortunately, some drivers (Cisco) don't make a distinction between
-		 * Open System authentication mode and whether or not to use WEP.  You
-		 * DON'T have to use WEP when using Open System, but these cards force
-		 * it.  Therefore, we have to set Open System mode when using WEP.
-		 */
+		struct iwreq	wreq = {
+			.u.data.pointer = (caddr_t) NULL,
+			.u.data.length = 0,
+			.u.data.flags = IW_ENCODE_DISABLED
+		};
 
-		if (strlen ((char *) safe_key) == 0)
-		{
-			wreq.u.data.flags |= IW_ENCODE_DISABLED | IW_ENCODE_NOKEY;
-			set_key = TRUE;
-		}
-		else
-		{
-			unsigned char		parsed_key[IW_ENCODING_TOKEN_MAX + 1];
-
-			keylen = iw_in_key_full (nm_dev_sock_get_fd (sk), iface,
-		(char *) safe_key, parsed_key[0], wreq.u.data.flags);
-			if (keylen  0)
-			{
-switch (auth_method)
-{
-	case IW_AUTH_ALG_OPEN_SYSTEM:
-		wreq.u.data.flags |= IW_ENCODE_OPEN;
-		break;
-	case IW_AUTH_ALG_SHARED_KEY:
-		wreq.u.data.flags |= IW_ENCODE_RESTRICTED;
-		break;
-	default:
-		wreq.u.data.flags |= IW_ENCODE_RESTRICTED;
-		break;
-}
-wreq.u.data.pointer	=  (caddr_t) parsed_key;

NM not connecting on resume, ipw2200

2006-07-12 Thread Bill Moss
Some recent patches to NM and ipw2200 should take care of the failure to 
connect on resume from suspend.

1. NM failed to set the essid to ANY but instead left the essid 
unchanged when deactivating a wireless network. Consequently, when NM 
resumed the essid still had its previous value. Dan applied patches at 
HEAD 1.934 to fix this.

2. Two patches were made to ipw2200 version 1.1.3. From the Changelog

* ipw_wx_set_essid fix (thanks to Bill Moss)
* Reassociate even if set the same essid (thanks to Bill Moss)

With these patches in place, my tests show that NM is much more robust 
about reconnection after resume, or enable wireless, or enable networking.

For ipw2200 users, I would suggest the module options

options ipw2200 hwcrypto=0 associate=0

Actually hwcrypto=0 is now the default. ipw2200 exhibits occasional 
firmware restarts with hwcrypto=1 which will cause NM to disconnect. 
associate=1 is the default. When ipw2200 is not associated, ipw2200 will 
scan about 3 times per second looking for an AP to automatically connect 
to. This sends a stream of scan completion events to NM. associate=0 
turns off the scanning when not associated. When NM needs a scan, it 
will ask for one.
**

-- 
Bill Moss
Alumni Distinguished Profess
Mathematical Sciences
Clemson University

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