08bebe1a6121eefb06511af8ba3d11ec8c6300ad
[openwrt/svn-archive/archive.git] / package / hostapd / patches / 730-nl80211_enable_qosdata.patch
1 --- a/src/drivers/driver_nl80211.c
2 +++ b/src/drivers/driver_nl80211.c
3 @@ -4263,7 +4263,7 @@ static const u8 rfc1042_header[6] = { 0x
4
5 static int wpa_driver_nl80211_hapd_send_eapol(
6 void *priv, const u8 *addr, const u8 *data,
7 - size_t data_len, int encrypt, const u8 *own_addr)
8 + size_t data_len, int encrypt, const u8 *own_addr, u32 flags)
9 {
10 struct i802_bss *bss = priv;
11 struct wpa_driver_nl80211_data *drv = bss->drv;
12 @@ -4271,11 +4271,7 @@ static int wpa_driver_nl80211_hapd_send_
13 size_t len;
14 u8 *pos;
15 int res;
16 -#if 0 /* FIX */
17 - int qos = sta->flags & WPA_STA_WMM;
18 -#else
19 - int qos = 0;
20 -#endif
21 + int qos = flags & WPA_STA_WMM;
22
23 len = sizeof(*hdr) + (qos ? 2 : 0) + sizeof(rfc1042_header) + 2 +
24 data_len;
25 @@ -4291,26 +4287,22 @@ static int wpa_driver_nl80211_hapd_send_
26 hdr->frame_control |= host_to_le16(WLAN_FC_FROMDS);
27 if (encrypt)
28 hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP);
29 -#if 0 /* To be enabled if qos determination is added above */
30 if (qos) {
31 hdr->frame_control |=
32 host_to_le16(WLAN_FC_STYPE_QOS_DATA << 4);
33 }
34 -#endif
35
36 memcpy(hdr->IEEE80211_DA_FROMDS, addr, ETH_ALEN);
37 memcpy(hdr->IEEE80211_BSSID_FROMDS, own_addr, ETH_ALEN);
38 memcpy(hdr->IEEE80211_SA_FROMDS, own_addr, ETH_ALEN);
39 pos = (u8 *) (hdr + 1);
40
41 -#if 0 /* To be enabled if qos determination is added above */
42 if (qos) {
43 /* add an empty QoS header if needed */
44 pos[0] = 0;
45 pos[1] = 0;
46 pos += 2;
47 }
48 -#endif
49
50 memcpy(pos, rfc1042_header, sizeof(rfc1042_header));
51 pos += sizeof(rfc1042_header);
52 --- a/src/drivers/driver.h
53 +++ b/src/drivers/driver.h
54 @@ -1396,7 +1396,7 @@ struct wpa_driver_ops {
55 */
56 int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
57 size_t data_len, int encrypt,
58 - const u8 *own_addr);
59 + const u8 *own_addr, u32 flags);
60
61 /**
62 * sta_deauth - Deauthenticate a station (AP only)
63 --- a/src/drivers/driver_madwifi.c
64 +++ b/src/drivers/driver_madwifi.c
65 @@ -1097,7 +1097,7 @@ madwifi_wireless_event_init(struct madwi
66
67 static int
68 madwifi_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
69 - int encrypt, const u8 *own_addr)
70 + int encrypt, const u8 *own_addr, u32 flags)
71 {
72 struct madwifi_driver_data *drv = priv;
73 unsigned char buf[3000];
74 --- a/src/drivers/driver_test.c
75 +++ b/src/drivers/driver_test.c
76 @@ -175,7 +175,7 @@ test_driver_get_cli(struct wpa_driver_te
77
78 static int test_driver_send_eapol(void *priv, const u8 *addr, const u8 *data,
79 size_t data_len, int encrypt,
80 - const u8 *own_addr)
81 + const u8 *own_addr, u32 flags)
82 {
83 struct test_driver_bss *dbss = priv;
84 struct wpa_driver_test_data *drv = dbss->drv;
85 --- a/src/drivers/driver_hostap.c
86 +++ b/src/drivers/driver_hostap.c
87 @@ -294,7 +294,8 @@ static int hostap_send_mlme(void *priv,
88
89
90 static int hostap_send_eapol(void *priv, const u8 *addr, const u8 *data,
91 - size_t data_len, int encrypt, const u8 *own_addr)
92 + size_t data_len, int encrypt, const u8 *own_addr,
93 + u32 flags)
94 {
95 struct hostap_driver_data *drv = priv;
96 struct ieee80211_hdr *hdr;
97 --- a/src/drivers/driver_atheros.c
98 +++ b/src/drivers/driver_atheros.c
99 @@ -1132,7 +1132,7 @@ atheros_wireless_event_init(struct ather
100
101 static int
102 atheros_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
103 - int encrypt, const u8 *own_addr)
104 + int encrypt, const u8 *own_addr, u32 flags)
105 {
106 struct atheros_driver_data *drv = priv;
107 unsigned char buf[3000];
108 --- a/src/drivers/driver_bsd.c
109 +++ b/src/drivers/driver_bsd.c
110 @@ -516,7 +516,7 @@ no_ie:
111
112 static int
113 bsd_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
114 - int encrypt, const u8 *own_addr)
115 + int encrypt, const u8 *own_addr, u32 flags)
116 {
117 struct bsd_driver_data *drv = priv;
118
119 --- a/src/ap/ap_drv_ops.h
120 +++ b/src/ap/ap_drv_ops.h
121 @@ -135,13 +135,14 @@ static inline int hostapd_drv_sta_remove
122
123 static inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd,
124 const u8 *addr, const u8 *data,
125 - size_t data_len, int encrypt)
126 + size_t data_len, int encrypt,
127 + u32 flags)
128 {
129 if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
130 return 0;
131 return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
132 data_len, encrypt,
133 - hapd->own_addr);
134 + hapd->own_addr, flags);
135 }
136
137 static inline int hostapd_drv_read_sta_data(
138 --- a/src/ap/ieee802_1x.c
139 +++ b/src/ap/ieee802_1x.c
140 @@ -73,7 +73,7 @@ static void ieee802_1x_send(struct hosta
141 rsn_preauth_send(hapd, sta, buf, len);
142 } else {
143 hostapd_drv_hapd_send_eapol(hapd, sta->addr, buf, len,
144 - encrypt);
145 + encrypt, sta->flags);
146 }
147
148 os_free(buf);
149 --- a/src/ap/wpa_auth_glue.c
150 +++ b/src/ap/wpa_auth_glue.c
151 @@ -243,8 +243,15 @@ static int hostapd_wpa_auth_send_eapol(v
152 int encrypt)
153 {
154 struct hostapd_data *hapd = ctx;
155 + struct sta_info *sta;
156 + u32 flags = 0;
157 +
158 + sta = ap_get_sta(hapd, addr);
159 + if (sta)
160 + flags = sta->flags;
161 +
162 return hostapd_drv_hapd_send_eapol(hapd, addr, data, data_len,
163 - encrypt);
164 + encrypt, flags);
165 }
166
167
168 --- a/wpa_supplicant/driver_i.h
169 +++ b/wpa_supplicant/driver_i.h
170 @@ -351,12 +351,12 @@ static inline int wpa_drv_sta_remove(str
171 static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s,
172 const u8 *addr, const u8 *data,
173 size_t data_len, int encrypt,
174 - const u8 *own_addr)
175 + const u8 *own_addr, u32 flags)
176 {
177 if (wpa_s->driver->hapd_send_eapol)
178 return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr,
179 data, data_len, encrypt,
180 - own_addr);
181 + own_addr, flags);
182 return -1;
183 }
184
185 --- a/src/drivers/driver_wired.c
186 +++ b/src/drivers/driver_wired.c
187 @@ -314,7 +314,7 @@ static int wired_init_sockets(struct wpa
188
189 static int wired_send_eapol(void *priv, const u8 *addr,
190 const u8 *data, size_t data_len, int encrypt,
191 - const u8 *own_addr)
192 + const u8 *own_addr, u32 flags)
193 {
194 struct wpa_driver_wired_data *drv = priv;
195 struct ieee8023_hdr *hdr;