| 1 | --- a/src/ap/ieee802_11.c |
| 2 | +++ b/src/ap/ieee802_11.c |
| 3 | @@ -1471,13 +1471,6 @@ static void handle_assoc_cb(struct hosta |
| 4 | int new_assoc = 1; |
| 5 | struct ieee80211_ht_capabilities ht_cap; |
| 6 | |
| 7 | - if (!ok) { |
| 8 | - hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, |
| 9 | - HOSTAPD_LEVEL_DEBUG, |
| 10 | - "did not acknowledge association response"); |
| 11 | - return; |
| 12 | - } |
| 13 | - |
| 14 | if (len < IEEE80211_HDRLEN + (reassoc ? sizeof(mgmt->u.reassoc_resp) : |
| 15 | sizeof(mgmt->u.assoc_resp))) { |
| 16 | printf("handle_assoc_cb(reassoc=%d) - too short payload " |
| 17 | @@ -1485,11 +1478,6 @@ static void handle_assoc_cb(struct hosta |
| 18 | return; |
| 19 | } |
| 20 | |
| 21 | - if (reassoc) |
| 22 | - status = le_to_host16(mgmt->u.reassoc_resp.status_code); |
| 23 | - else |
| 24 | - status = le_to_host16(mgmt->u.assoc_resp.status_code); |
| 25 | - |
| 26 | sta = ap_get_sta(hapd, mgmt->da); |
| 27 | if (!sta) { |
| 28 | printf("handle_assoc_cb: STA " MACSTR " not found\n", |
| 29 | @@ -1497,6 +1485,19 @@ static void handle_assoc_cb(struct hosta |
| 30 | return; |
| 31 | } |
| 32 | |
| 33 | + if (!ok) { |
| 34 | + hostapd_logger(hapd, mgmt->da, HOSTAPD_MODULE_IEEE80211, |
| 35 | + HOSTAPD_LEVEL_DEBUG, |
| 36 | + "did not acknowledge association response"); |
| 37 | + sta->flags &= ~WLAN_STA_ASSOC_REQ_OK; |
| 38 | + return; |
| 39 | + } |
| 40 | + |
| 41 | + if (reassoc) |
| 42 | + status = le_to_host16(mgmt->u.reassoc_resp.status_code); |
| 43 | + else |
| 44 | + status = le_to_host16(mgmt->u.assoc_resp.status_code); |
| 45 | + |
| 46 | if (status != WLAN_STATUS_SUCCESS) |
| 47 | goto fail; |
| 48 | |
| 49 | --- a/src/drivers/driver_nl80211.c |
| 50 | +++ b/src/drivers/driver_nl80211.c |
| 51 | @@ -181,6 +181,7 @@ struct i802_bss { |
| 52 | struct wpa_driver_nl80211_data *drv; |
| 53 | struct i802_bss *next; |
| 54 | int ifindex; |
| 55 | + u8 addr[ETH_ALEN]; |
| 56 | char ifname[IFNAMSIZ + 1]; |
| 57 | char brname[IFNAMSIZ]; |
| 58 | unsigned int beacon_set:1; |
| 59 | @@ -191,7 +192,6 @@ struct i802_bss { |
| 60 | struct wpa_driver_nl80211_data { |
| 61 | struct nl80211_global *global; |
| 62 | struct dl_list list; |
| 63 | - u8 addr[ETH_ALEN]; |
| 64 | char phyname[32]; |
| 65 | void *ctx; |
| 66 | int ifindex; |
| 67 | @@ -2482,7 +2482,7 @@ wpa_driver_nl80211_finish_drv_init(struc |
| 68 | return -1; |
| 69 | |
| 70 | if (linux_get_ifhwaddr(drv->global->ioctl_sock, bss->ifname, |
| 71 | - drv->addr)) |
| 72 | + bss->addr)) |
| 73 | return -1; |
| 74 | |
| 75 | if (nl80211_register_action_frames(drv) < 0) { |
| 76 | @@ -5176,8 +5176,8 @@ static int wpa_driver_nl80211_hapd_send_ |
| 77 | pos = (u8 *) (hdr + 1); |
| 78 | |
| 79 | if (qos) { |
| 80 | - /* add an empty QoS header if needed */ |
| 81 | - pos[0] = 0; |
| 82 | + /* Set highest priority in QoS header */ |
| 83 | + pos[0] = 7; |
| 84 | pos[1] = 0; |
| 85 | pos += 2; |
| 86 | } |
| 87 | @@ -6407,7 +6407,7 @@ static int i802_set_wds_sta(void *priv, |
| 88 | if (!if_nametoindex(name)) { |
| 89 | if (nl80211_create_iface(drv, name, |
| 90 | NL80211_IFTYPE_AP_VLAN, |
| 91 | - NULL, 1) < 0) |
| 92 | + bss->addr, 1) < 0) |
| 93 | return -1; |
| 94 | if (bridge_ifname && |
| 95 | linux_br_add_if(drv->global->ioctl_sock, |
| 96 | @@ -6417,6 +6417,10 @@ static int i802_set_wds_sta(void *priv, |
| 97 | linux_set_iface_flags(drv->global->ioctl_sock, name, 1); |
| 98 | return i802_set_sta_vlan(priv, addr, name, 0); |
| 99 | } else { |
| 100 | + if (bridge_ifname) |
| 101 | + linux_br_del_if(drv->global->ioctl_sock, bridge_ifname, |
| 102 | + name); |
| 103 | + |
| 104 | i802_set_sta_vlan(priv, addr, bss->ifname, 0); |
| 105 | return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN, |
| 106 | name); |
| 107 | @@ -6625,7 +6629,7 @@ static int nl80211_addr_in_use(struct nl |
| 108 | struct wpa_driver_nl80211_data *drv; |
| 109 | dl_list_for_each(drv, &global->interfaces, |
| 110 | struct wpa_driver_nl80211_data, list) { |
| 111 | - if (os_memcmp(addr, drv->addr, ETH_ALEN) == 0) |
| 112 | + if (os_memcmp(addr, drv->first_bss.addr, ETH_ALEN) == 0) |
| 113 | return 1; |
| 114 | } |
| 115 | return 0; |
| 116 | @@ -6640,9 +6644,9 @@ static int nl80211_p2p_interface_addr(st |
| 117 | if (!drv->global) |
| 118 | return -1; |
| 119 | |
| 120 | - os_memcpy(new_addr, drv->addr, ETH_ALEN); |
| 121 | + os_memcpy(new_addr, drv->first_bss.addr, ETH_ALEN); |
| 122 | for (idx = 0; idx < 64; idx++) { |
| 123 | - new_addr[0] = drv->addr[0] | 0x02; |
| 124 | + new_addr[0] = drv->first_bss.addr[0] | 0x02; |
| 125 | new_addr[0] ^= idx << 2; |
| 126 | if (!nl80211_addr_in_use(drv->global, new_addr)) |
| 127 | break; |
| 128 | @@ -6745,6 +6749,7 @@ static int wpa_driver_nl80211_if_add(voi |
| 129 | os_free(new_bss); |
| 130 | return -1; |
| 131 | } |
| 132 | + memcpy(new_bss->addr, addr ? addr : if_addr, ETH_ALEN); |
| 133 | os_strlcpy(new_bss->ifname, ifname, IFNAMSIZ); |
| 134 | new_bss->ifindex = ifidx; |
| 135 | new_bss->drv = drv; |
| 136 | @@ -6775,7 +6780,12 @@ static int wpa_driver_nl80211_if_remove( |
| 137 | if (ifindex <= 0) |
| 138 | return -1; |
| 139 | |
| 140 | + nl80211_remove_iface(drv, ifindex); |
| 141 | + |
| 142 | #ifdef HOSTAPD |
| 143 | + if (type != WPA_IF_AP_BSS) |
| 144 | + return 0; |
| 145 | + |
| 146 | if (bss->added_if_into_bridge) { |
| 147 | if (linux_br_del_if(drv->global->ioctl_sock, bss->brname, |
| 148 | bss->ifname) < 0) |
| 149 | @@ -6789,13 +6799,6 @@ static int wpa_driver_nl80211_if_remove( |
| 150 | "bridge %s: %s", |
| 151 | bss->brname, strerror(errno)); |
| 152 | } |
| 153 | -#endif /* HOSTAPD */ |
| 154 | - |
| 155 | - nl80211_remove_iface(drv, ifindex); |
| 156 | - |
| 157 | -#ifdef HOSTAPD |
| 158 | - if (type != WPA_IF_AP_BSS) |
| 159 | - return 0; |
| 160 | |
| 161 | if (bss != &drv->first_bss) { |
| 162 | struct i802_bss *tbss; |
| 163 | --- a/src/ap/wpa_auth.c |
| 164 | +++ b/src/ap/wpa_auth.c |
| 165 | @@ -776,7 +776,14 @@ void wpa_receive(struct wpa_authenticato |
| 166 | } |
| 167 | |
| 168 | if (sm->wpa == WPA_VERSION_WPA2) { |
| 169 | - if (key->type != EAPOL_KEY_TYPE_RSN) { |
| 170 | + if (key->type == EAPOL_KEY_TYPE_WPA) { |
| 171 | + /* |
| 172 | + * Some deployed station implementations seem to send |
| 173 | + * msg 4/4 with incorrect type value in WPA2 mode. |
| 174 | + */ |
| 175 | + wpa_printf(MSG_DEBUG, "Workaround: Allow EAPOL-Key " |
| 176 | + "with unexpected WPA type in RSN mode"); |
| 177 | + } else if (key->type != EAPOL_KEY_TYPE_RSN) { |
| 178 | wpa_printf(MSG_DEBUG, "Ignore EAPOL-Key with " |
| 179 | "unexpected type %d in RSN mode", |
| 180 | key->type); |
| 181 | |