uml: this patch went upstream
[openwrt.git] / package / hostapd / patches / 340-madwifi_key_fixes.patch
1 --- a/src/drivers/driver_madwifi.c
2 +++ b/src/drivers/driver_madwifi.c
3 @@ -464,15 +464,30 @@ madwifi_set_key(const char *ifname, void
4 memset(wk.ik_macaddr, 0xff, IEEE80211_ADDR_LEN);
5 wk.ik_keyix = key_idx;
6 wk.ik_flags |= IEEE80211_KEY_DEFAULT;
7 + wk.ik_flags |= IEEE80211_KEY_GROUP;
8 } else if (!memcmp(addr, "\xff\xff\xff\xff\xff\xff", ETH_ALEN)) {
9 + wk.ik_keyix = key_idx;
10 wk.ik_flags |= IEEE80211_KEY_GROUP;
11 - memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
12 + memset(wk.ik_macaddr, 0, IEEE80211_ADDR_LEN);
13 } else {
14 memcpy(wk.ik_macaddr, addr, IEEE80211_ADDR_LEN);
15 wk.ik_keyix = IEEE80211_KEYIX_NONE;
16 }
17 wk.ik_keylen = key_len;
18 memcpy(wk.ik_keydata, key, key_len);
19 +#ifdef WORDS_BIGENDIAN
20 +#define WPA_KEY_RSC_LEN 8
21 + {
22 + size_t i;
23 + u8 tmp[WPA_KEY_RSC_LEN];
24 + os_memset(tmp, 0, sizeof(tmp));
25 + for (i = 0; i < seq_len; i++)
26 + tmp[WPA_KEY_RSC_LEN - i - 1] = seq[i];
27 + os_memcpy(&wk.ik_keyrsc, tmp, WPA_KEY_RSC_LEN);
28 + }
29 +#else /* WORDS_BIGENDIAN */
30 + os_memcpy(&wk.ik_keyrsc, seq, seq_len);
31 +#endif /* WORDS_BIGENDIAN */
32
33 ret = set80211priv(drv, IEEE80211_IOCTL_SETKEY, &wk, sizeof(wk));
34 if (ret < 0) {
This page took 0.046388 seconds and 5 git commands to generate.