On Tue, May 12, 2009 at 8:05 PM, Hin-Tak Leung <hintak.leung@xxxxxxxxx> wrote: > On Tue, May 12, 2009 at 11:44 AM, Johannes Berg > <johannes@xxxxxxxxxxxxxxxx> wrote: >> There are a few small bugs/oversights in the key handling >> code I wrote: >> * SIOCSIWENCODE should default to setting key 0 if no >> default key is set already and no index is given, >> * key removal should not require key material, >> * SIOCSIWENCODEEXT should default to changing the default >> management key if no index is given. >> >> Signed-off-by: Johannes Berg <johannes@xxxxxxxxxxxxxxxx> >> --- >> net/wireless/wext-compat.c | 14 +++++--------- >> 1 file changed, 5 insertions(+), 9 deletions(-) >> >> --- wireless-testing.orig/net/wireless/wext-compat.c 2009-05-12 12:38:41.000000000 +0200 >> +++ wireless-testing/net/wireless/wext-compat.c 2009-05-12 12:38:59.000000000 +0200 >> @@ -557,7 +557,7 @@ int cfg80211_wext_siwencode(struct net_d >> if (idx == 0) { >> idx = wdev->wext.default_key; >> if (idx < 0) >> - return -EINVAL; >> + idx = 0; >> } else if (idx < 1 || idx > 4) >> return -EINVAL; >> else >> @@ -580,7 +580,7 @@ int cfg80211_wext_siwencode(struct net_d >> params.cipher = WLAN_CIPHER_SUITE_WEP40; >> else if (erq->length == 13) >> params.cipher = WLAN_CIPHER_SUITE_WEP104; >> - else >> + else if (!remove) >> return -EINVAL; >> >> return cfg80211_set_encryption(rdev, dev, NULL, remove, >> @@ -640,13 +640,9 @@ int cfg80211_wext_siwencodeext(struct ne >> idx = erq->flags & IW_ENCODE_INDEX; >> if (cipher == WLAN_CIPHER_SUITE_AES_CMAC) { >> if (idx < 4 || idx > 5) { >> - /* >> - * XXX: Only wpa_supplicant ever used this >> - * can we still change the ABI a little >> - * so we do not need to keep track of >> - * the default key? >> - */ >> - return -EINVAL; >> + idx = wdev->wext.default_mgmt_key; >> + if (idx < 0) >> + return -EINVAL; >> } else >> idx--; >> } else { >> >> >> > > I tried this, NM/wpa_suplicany still doesn't work, but if I shut those > down and do it the old fashioned iwconfig way, I can get > connectivity... the last chunk looks a bit funny - '(idx < 4 || idx > > 5)' is just '(idx != 4)' so why it isn't written simplier as such? > also the idx < 0 maybe <1 ? > > Stiill needs some work... > BTW, nm fails to connect with <WARN> nm_device_wifi_disable_encryption(): error setting key for device wlan2: No such file or directory -- To unsubscribe from this list: send the line "unsubscribe linux-wireless" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html