/* * AzureWave AW-NR580 board support * * Copyright (C) 2008-2012 Gabor Juhos * Copyright (C) 2008 Imre Kaloz * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 as published * by the Free Software Foundation. */ #include #include "dev-eth.h" #include "dev-m25p80.h" #include "dev-gpio-buttons.h" #include "dev-leds-gpio.h" #include "machtypes.h" #include "pci.h" #define AW_NR580_GPIO_LED_READY_RED 0 #define AW_NR580_GPIO_LED_WLAN 1 #define AW_NR580_GPIO_LED_READY_GREEN 2 #define AW_NR580_GPIO_LED_WPS_GREEN 4 #define AW_NR580_GPIO_LED_WPS_AMBER 5 #define AW_NR580_GPIO_BTN_WPS 3 #define AW_NR580_GPIO_BTN_RESET 11 #define AW_NR580_KEYS_POLL_INTERVAL 20 /* msecs */ #define AW_NR580_KEYS_DEBOUNCE_INTERVAL (3 * AW_NR580_KEYS_POLL_INTERVAL) static struct gpio_led aw_nr580_leds_gpio[] __initdata = { { .name = "aw-nr580:red:ready", .gpio = AW_NR580_GPIO_LED_READY_RED, .active_low = 0, }, { .name = "aw-nr580:green:ready", .gpio = AW_NR580_GPIO_LED_READY_GREEN, .active_low = 0, }, { .name = "aw-nr580:green:wps", .gpio = AW_NR580_GPIO_LED_WPS_GREEN, .active_low = 0, }, { .name = "aw-nr580:amber:wps", .gpio = AW_NR580_GPIO_LED_WPS_AMBER, .active_low = 0, }, { .name = "aw-nr580:green:wlan", .gpio = AW_NR580_GPIO_LED_WLAN, .active_low = 0, } }; static struct gpio_keys_button aw_nr580_gpio_keys[] __initdata = { { .desc = "reset", .type = EV_KEY, .code = KEY_RESTART, .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL, .gpio = AW_NR580_GPIO_BTN_RESET, .active_low = 1, }, { .desc = "wps", .type = EV_KEY, .code = KEY_WPS_BUTTON, .debounce_interval = AW_NR580_KEYS_DEBOUNCE_INTERVAL, .gpio = AW_NR580_GPIO_BTN_WPS, .active_low = 1, } }; static const char *aw_nr580_part_probes[] = { "RedBoot", NULL, }; static struct flash_platform_data aw_nr580_flash_data = { .part_probes = aw_nr580_part_probes, }; static void __init aw_nr580_setup(void) { ath79_register_mdio(0, 0x0); ath79_eth0_data.phy_if_mode = PHY_INTERFACE_MODE_MII; ath79_eth0_data.speed = SPEED_100; ath79_eth0_data.duplex = DUPLEX_FULL; ath79_register_eth(0); ath79_register_pci(); ath79_register_m25p80(&aw_nr580_flash_data); ath79_register_leds_gpio(-1, ARRAY_SIZE(aw_nr580_leds_gpio), aw_nr580_leds_gpio); ath79_register_gpio_keys_polled(-1, AW_NR580_KEYS_POLL_INTERVAL, ARRAY_SIZE(aw_nr580_gpio_keys), aw_nr580_gpio_keys); } MIPS_MACHINE(ATH79_MACH_AW_NR580, "AW-NR580", "AzureWave AW-NR580", aw_nr580_setup); c1&id=43ff6e641e7c321ab3b67c43ba73a6877d8f0439'>diffstats
blob: 9dee2d738e3979d960553ef08d92df302c544ad1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
--- a/src/common/wpa_common.c
+++ b/src/common/wpa_common.c
@@ -2121,6 +2121,31 @@ u32 wpa_akm_to_suite(int akm)
 }
 
 
+static void wpa_fixup_wpa_ie_rsn(u8 *assoc_ie, const u8 *wpa_msg_ie,
+				 size_t rsn_ie_len)
+{
+	int pos, count;
+
+	pos = sizeof(struct rsn_ie_hdr) + RSN_SELECTOR_LEN;
+	if (rsn_ie_len < pos + 2)
+		return;
+
+	count = WPA_GET_LE16(wpa_msg_ie + pos);
+	pos += 2 + count * RSN_SELECTOR_LEN;
+	if (rsn_ie_len < pos + 2)
+		return;
+
+	count = WPA_GET_LE16(wpa_msg_ie + pos);
+	pos += 2 + count * RSN_SELECTOR_LEN;
+	if (rsn_ie_len < pos + 2)
+		return;
+
+	if (!assoc_ie[pos] && !assoc_ie[pos + 1] &&
+	    (wpa_msg_ie[pos] || wpa_msg_ie[pos + 1]))
+		memcpy(&assoc_ie[pos], &wpa_msg_ie[pos], 2);
+}
+
+
 int wpa_compare_rsn_ie(int ft_initial_assoc,
 		       const u8 *ie1, size_t ie1len,
 		       const u8 *ie2, size_t ie2len)
@@ -2128,8 +2153,19 @@ int wpa_compare_rsn_ie(int ft_initial_as
 	if (ie1 == NULL || ie2 == NULL)
 		return -1;
 
-	if (ie1len == ie2len && os_memcmp(ie1, ie2, ie1len) == 0)
-		return 0; /* identical IEs */
+	if (ie1len == ie2len) {
+		u8 *ie_tmp;
+
+		if (os_memcmp(ie1, ie2, ie1len) == 0)
+			return 0; /* identical IEs */
+
+		ie_tmp = alloca(ie1len);
+		memcpy(ie_tmp, ie1, ie1len);
+		wpa_fixup_wpa_ie_rsn(ie_tmp, ie2, ie1len);
+
+		if (os_memcmp(ie_tmp, ie2, ie1len) == 0)
+			return 0; /* only mismatch in RSN capabilties */
+	}
 
 #ifdef CONFIG_IEEE80211R
 	if (ft_initial_assoc) {