aboutsummaryrefslogtreecommitdiffstats
path: root/package
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2010-11-09 01:36:43 +0000
committerFelix Fietkau <nbd@openwrt.org>2010-11-09 01:36:43 +0000
commit08d99823149d1f25cc1fdec6f5adf0d4f18d85b3 (patch)
treedfa12c5b6e0428472efbb547b9481d15677ee7a8 /package
parentbe617d74f89ea6df86914da9ac3fdf0fe61f5a15 (diff)
downloadupstream-08d99823149d1f25cc1fdec6f5adf0d4f18d85b3.tar.gz
upstream-08d99823149d1f25cc1fdec6f5adf0d4f18d85b3.tar.bz2
upstream-08d99823149d1f25cc1fdec6f5adf0d4f18d85b3.zip
hostapd: add some wpa related madwifi fixes
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@23933 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package')
-rw-r--r--package/hostapd/patches/400-madwifi_key_fixes.patch48
1 files changed, 48 insertions, 0 deletions
diff --git a/package/hostapd/patches/400-madwifi_key_fixes.patch b/package/hostapd/patches/400-madwifi_key_fixes.patch
new file mode 100644
index 0000000000..d6883ffce4
--- /dev/null
+++ b/package/hostapd/patches/400-madwifi_key_fixes.patch
@@ -0,0 +1,48 @@
+--- a/src/drivers/driver_madwifi.c
++++ b/src/drivers/driver_madwifi.c
+@@ -438,9 +438,11 @@ madwifi_set_key(const char *ifname, void
+ wpa_printf(MSG_DEBUG, "%s: alg=%d addr=%s key_idx=%d",
+ __func__, alg, ether_sprintf(addr), key_idx);
+
+- if (alg == WPA_ALG_WEP)
++ if (alg == WPA_ALG_WEP) {
+ cipher = IEEE80211_CIPHER_WEP;
+- else if (alg == WPA_ALG_TKIP)
++ if (!addr || !memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN))
++ return wpa_driver_wext_set_key(ifname, drv->wext, alg, addr, key_idx, set_tx, seq, seq_len, key, key_len);
++ } else if (alg == WPA_ALG_TKIP)
+ cipher = IEEE80211_CIPHER_TKIP;
+ else if (alg == WPA_ALG_CCMP)
+ cipher = IEEE80211_CIPHER_AES_CCM;
+@@ -464,15 +466,30 @@ madwifi_set_key(const char *ifname, void
+ memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
+ wk.ik_keyix = key_idx;
+ wk.ik_flags |= IEEE80211_KEY_DEFAULT;
++ wk.ik_flags |= IEEE80211_KEY_GROUP;
+ } else if (!memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) {
++ wk.ik_keyix = key_idx;
+ wk.ik_flags |= IEEE80211_KEY_GROUP;
+- memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
++ memset(wk.ik_macaddr, 0, IEEE80211_ADDR_LEN);
+ } else {
+ memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
+ wk.ik_keyix = IEEE80211_KEYIX_NONE;
+ }
+ wk.ik_keylen = key_len;
+ memcpy(wk.ik_keydata, key, key_len);
++#ifdef WORDS_BIGENDIAN
++#define WPA_KEY_RSC_LEN 8
++ {
++ size_t i;
++ u8 tmp[WPA_KEY_RSC_LEN];
++ os_memset(tmp, 0, sizeof(tmp));
++ for (i = 0; i < seq_len; i++)
++ tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i];
++ os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
++ }
++#else /* WORDS_BIGENDIAN */
++ os_memcpy(&wk.ik_keyrsc, seq, seq_len);
++#endif /* WORDS_BIGENDIAN */
+
+ ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk));
+ if (ret < 0) {