netifd: update to 2012-03-23, fixes route/address tracking issues and adds more statu...
[openwrt.git] / package / hostapd / patches / 570-wpa_ie_cap_workaround.patch
1 --- a/src/common/wpa_common.c
2 +++ b/src/common/wpa_common.c
3 @@ -959,6 +959,31 @@ const char * wpa_key_mgmt_txt(int key_mg
4 }
5
6
7 +static void wpa_fixup_wpa_ie_rsn(u8 *assoc_ie, const u8 *wpa_msg_ie,
8 + size_t rsn_ie_len)
9 +{
10 + int pos, count;
11 +
12 + pos = sizeof(struct rsn_ie_hdr) + RSN_SELECTOR_LEN;
13 + if (rsn_ie_len < pos + 2)
14 + return;
15 +
16 + count = WPA_GET_LE16(wpa_msg_ie + pos);
17 + pos += 2 + count * RSN_SELECTOR_LEN;
18 + if (rsn_ie_len < pos + 2)
19 + return;
20 +
21 + count = WPA_GET_LE16(wpa_msg_ie + pos);
22 + pos += 2 + count * RSN_SELECTOR_LEN;
23 + if (rsn_ie_len < pos + 2)
24 + return;
25 +
26 + if (!assoc_ie[pos] && !assoc_ie[pos + 1] &&
27 + (wpa_msg_ie[pos] || wpa_msg_ie[pos + 1]))
28 + memcpy(&assoc_ie[pos], &wpa_msg_ie[pos], 2);
29 +}
30 +
31 +
32 int wpa_compare_rsn_ie(int ft_initial_assoc,
33 const u8 *ie1, size_t ie1len,
34 const u8 *ie2, size_t ie2len)
35 @@ -966,8 +991,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
36 if (ie1 == NULL || ie2 == NULL)
37 return -1;
38
39 - if (ie1len == ie2len && os_memcmp(ie1, ie2, ie1len) == 0)
40 - return 0; /* identical IEs */
41 + if (ie1len == ie2len) {
42 + u8 *ie_tmp;
43 +
44 + if (os_memcmp(ie1, ie2, ie1len) == 0)
45 + return 0; /* identical IEs */
46 +
47 + ie_tmp = alloca(ie1len);
48 + memcpy(ie_tmp, ie1, ie1len);
49 + wpa_fixup_wpa_ie_rsn(ie_tmp, ie2, ie1len);
50 +
51 + if (os_memcmp(ie_tmp, ie2, ie1len) == 0)
52 + return 0; /* only mismatch in RSN capabilties */
53 + }
54
55 #ifdef CONFIG_IEEE80211R
56 if (ft_initial_assoc) {
This page took 0.048226 seconds and 5 git commands to generate.