cns21xx: remove 3.7 support
[openwrt.git] / package / network / services / hostapd / patches / 100-pending_work.patch
1 --- a/src/ap/ieee802_11.c
2 +++ b/src/ap/ieee802_11.c
3 @@ -1506,13 +1506,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 @@ -1520,11 +1513,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 @@ -1532,6 +1520,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 @@ -1830,6 +1831,9 @@ void ieee802_11_rx_from_unknown(struct h
50  
51         sta = ap_get_sta(hapd, src);
52         if (sta && (sta->flags & WLAN_STA_ASSOC)) {
53 +               if (!hapd->conf->wds_sta)
54 +                       return;
55 +
56                 if (wds && !(sta->flags & WLAN_STA_WDS)) {
57                         wpa_printf(MSG_DEBUG, "Enable 4-address WDS mode for "
58                                    "STA " MACSTR " (aid %u)",
59 --- a/src/drivers/driver_nl80211.c
60 +++ b/src/drivers/driver_nl80211.c
61 @@ -2661,10 +2661,10 @@ static int wpa_driver_nl80211_capa(struc
62         drv->data_tx_status = info.data_tx_status;
63  
64         /*
65 -        * If poll command is supported mac80211 is new enough to
66 -        * have everything we need to not need monitor interfaces.
67 +        * If poll command and tx status are supported, mac80211 is new enough
68 +        * to have everything we need to not need monitor interfaces.
69          */
70 -       drv->use_monitor = !info.poll_command_supported;
71 +       drv->use_monitor = !info.poll_command_supported || !info.data_tx_status;
72  
73         if (drv->device_ap_sme && drv->use_monitor) {
74                 /*
75 @@ -6392,8 +6392,8 @@ static int wpa_driver_nl80211_hapd_send_
76         pos = (u8 *) (hdr + 1);
77  
78         if (qos) {
79 -               /* add an empty QoS header if needed */
80 -               pos[0] = 0;
81 +               /* Set highest priority in QoS header */
82 +               pos[0] = 7;
83                 pos[1] = 0;
84                 pos += 2;
85         }
86 @@ -7698,6 +7698,10 @@ static int i802_set_wds_sta(void *priv,
87                 }
88                 return i802_set_sta_vlan(priv, addr, name, 0);
89         } else {
90 +               if (bridge_ifname)
91 +                       linux_br_del_if(drv->global->ioctl_sock, bridge_ifname,
92 +                                       name);
93 +
94                 i802_set_sta_vlan(priv, addr, bss->ifname, 0);
95                 return wpa_driver_nl80211_if_remove(priv, WPA_IF_AP_VLAN,
96                                                     name);
97 @@ -8065,7 +8069,12 @@ static int wpa_driver_nl80211_if_remove(
98         if (ifindex <= 0)
99                 return -1;
100  
101 +       nl80211_remove_iface(drv, ifindex);
102 +
103  #ifdef HOSTAPD
104 +       if (type != WPA_IF_AP_BSS)
105 +               return 0;
106 +
107         if (bss->added_if_into_bridge) {
108                 if (linux_br_del_if(drv->global->ioctl_sock, bss->brname,
109                                     bss->ifname) < 0)
110 @@ -8079,13 +8088,6 @@ static int wpa_driver_nl80211_if_remove(
111                                    "bridge %s: %s",
112                                    bss->brname, strerror(errno));
113         }
114 -#endif /* HOSTAPD */
115 -
116 -       nl80211_remove_iface(drv, ifindex);
117 -
118 -#ifdef HOSTAPD
119 -       if (type != WPA_IF_AP_BSS)
120 -               return 0;
121  
122         if (bss != &drv->first_bss) {
123                 struct i802_bss *tbss;
124 --- a/src/ap/drv_callbacks.c
125 +++ b/src/ap/drv_callbacks.c
126 @@ -672,12 +672,15 @@ static void hostapd_event_eapol_rx(struc
127                                    const u8 *data, size_t data_len)
128  {
129         struct hostapd_iface *iface = hapd->iface;
130 +       struct sta_info *sta;
131         size_t j;
132  
133         for (j = 0; j < iface->num_bss; j++) {
134 -               if (ap_get_sta(iface->bss[j], src)) {
135 -                       hapd = iface->bss[j];
136 -                       break;
137 +               if ((sta = ap_get_sta(iface->bss[j], src))) {
138 +                       if (sta->flags & WLAN_STA_ASSOC) {
139 +                               hapd = iface->bss[j];
140 +                               break;
141 +                       }
142                 }
143         }
144  
145 --- a/src/eap_peer/eap.c
146 +++ b/src/eap_peer/eap.c
147 @@ -348,6 +348,7 @@ SM_STATE(EAP, METHOD)
148  {
149         struct wpabuf *eapReqData;
150         struct eap_method_ret ret;
151 +       int min_len = 1;
152  
153         SM_ENTRY(EAP, METHOD);
154         if (sm->m == NULL) {
155 @@ -356,7 +357,9 @@ SM_STATE(EAP, METHOD)
156         }
157  
158         eapReqData = eapol_get_eapReqData(sm);
159 -       if (!eap_hdr_len_valid(eapReqData, 1))
160 +       if (sm->m->vendor == EAP_VENDOR_IETF && sm->m->method == EAP_TYPE_LEAP)
161 +               min_len = 0; /* LEAP uses EAP-Success without payload */
162 +       if (!eap_hdr_len_valid(eapReqData, min_len))
163                 return;
164  
165         /*