nl80211: send EAP frames as QoS data frames for QoS aware clients, should fix EAP...
authorFelix Fietkau <nbd@openwrt.org>
Wed, 30 Mar 2011 11:38:35 +0000 (11:38 +0000)
committerFelix Fietkau <nbd@openwrt.org>
Wed, 30 Mar 2011 11:38:35 +0000 (11:38 +0000)
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@26367 3c298f89-4303-0410-b956-a3cf2f4a3e73

package/hostapd/patches/730-nl80211_enable_qosdata.patch [new file with mode: 0644]

diff --git a/package/hostapd/patches/730-nl80211_enable_qosdata.patch b/package/hostapd/patches/730-nl80211_enable_qosdata.patch
new file mode 100644 (file)
index 0000000..08bebe1
--- /dev/null
@@ -0,0 +1,195 @@
+--- a/src/drivers/driver_nl80211.c
++++ b/src/drivers/driver_nl80211.c
+@@ -4263,7 +4263,7 @@ static const u8 rfc1042_header[6] = { 0x
+ static int wpa_driver_nl80211_hapd_send_eapol(
+       void *priv, const u8 *addr, const u8 *data,
+-      size_t data_len, int encrypt, const u8 *own_addr)
++      size_t data_len, int encrypt, const u8 *own_addr, u32 flags)
+ {
+       struct i802_bss *bss = priv;
+       struct wpa_driver_nl80211_data *drv = bss->drv;
+@@ -4271,11 +4271,7 @@ static int wpa_driver_nl80211_hapd_send_
+       size_t len;
+       u8 *pos;
+       int res;
+-#if 0 /* FIX */
+-      int qos = sta->flags & WPA_STA_WMM;
+-#else
+-      int qos = 0;
+-#endif
++      int qos = flags & WPA_STA_WMM;
+       len = sizeof(*hdr) + (qos ? 2 : 0) + sizeof(rfc1042_header) + 2 +
+               data_len;
+@@ -4291,26 +4287,22 @@ static int wpa_driver_nl80211_hapd_send_
+       hdr->frame_control |= host_to_le16(WLAN_FC_FROMDS);
+       if (encrypt)
+               hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP);
+-#if 0 /* To be enabled if qos determination is added above */
+       if (qos) {
+               hdr->frame_control |=
+                       host_to_le16(WLAN_FC_STYPE_QOS_DATA << 4);
+       }
+-#endif
+       memcpy(hdr->IEEE80211_DA_FROMDS, addr, ETH_ALEN);
+       memcpy(hdr->IEEE80211_BSSID_FROMDS, own_addr, ETH_ALEN);
+       memcpy(hdr->IEEE80211_SA_FROMDS, own_addr, ETH_ALEN);
+       pos = (u8 *) (hdr + 1);
+-#if 0 /* To be enabled if qos determination is added above */
+       if (qos) {
+               /* add an empty QoS header if needed */
+               pos[0] = 0;
+               pos[1] = 0;
+               pos += 2;
+       }
+-#endif
+       memcpy(pos, rfc1042_header, sizeof(rfc1042_header));
+       pos += sizeof(rfc1042_header);
+--- a/src/drivers/driver.h
++++ b/src/drivers/driver.h
+@@ -1396,7 +1396,7 @@ struct wpa_driver_ops {
+        */
+       int (*hapd_send_eapol)(void *priv, const u8 *addr, const u8 *data,
+                              size_t data_len, int encrypt,
+-                             const u8 *own_addr);
++                             const u8 *own_addr, u32 flags);
+       /**
+        * sta_deauth - Deauthenticate a station (AP only)
+--- a/src/drivers/driver_madwifi.c
++++ b/src/drivers/driver_madwifi.c
+@@ -1097,7 +1097,7 @@ madwifi_wireless_event_init(struct madwi
+ static int
+ madwifi_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
+-                 int encrypt, const u8 *own_addr)
++                 int encrypt, const u8 *own_addr, u32 flags)
+ {
+       struct madwifi_driver_data *drv = priv;
+       unsigned char buf[3000];
+--- a/src/drivers/driver_test.c
++++ b/src/drivers/driver_test.c
+@@ -175,7 +175,7 @@ test_driver_get_cli(struct wpa_driver_te
+ static int test_driver_send_eapol(void *priv, const u8 *addr, const u8 *data,
+                                 size_t data_len, int encrypt,
+-                                const u8 *own_addr)
++                                const u8 *own_addr, u32 flags)
+ {
+       struct test_driver_bss *dbss = priv;
+       struct wpa_driver_test_data *drv = dbss->drv;
+--- a/src/drivers/driver_hostap.c
++++ b/src/drivers/driver_hostap.c
+@@ -294,7 +294,8 @@ static int hostap_send_mlme(void *priv, 
+ static int hostap_send_eapol(void *priv, const u8 *addr, const u8 *data,
+-                           size_t data_len, int encrypt, const u8 *own_addr)
++                           size_t data_len, int encrypt, const u8 *own_addr,
++                           u32 flags)
+ {
+       struct hostap_driver_data *drv = priv;
+       struct ieee80211_hdr *hdr;
+--- a/src/drivers/driver_atheros.c
++++ b/src/drivers/driver_atheros.c
+@@ -1132,7 +1132,7 @@ atheros_wireless_event_init(struct ather
+ static int
+ atheros_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
+-                 int encrypt, const u8 *own_addr)
++                 int encrypt, const u8 *own_addr, u32 flags)
+ {
+       struct atheros_driver_data *drv = priv;
+       unsigned char buf[3000];
+--- a/src/drivers/driver_bsd.c
++++ b/src/drivers/driver_bsd.c
+@@ -516,7 +516,7 @@ no_ie:
+ static int
+ bsd_send_eapol(void *priv, const u8 *addr, const u8 *data, size_t data_len,
+-             int encrypt, const u8 *own_addr)
++             int encrypt, const u8 *own_addr, u32 flags)
+ {
+       struct bsd_driver_data *drv = priv;
+--- a/src/ap/ap_drv_ops.h
++++ b/src/ap/ap_drv_ops.h
+@@ -135,13 +135,14 @@ static inline int hostapd_drv_sta_remove
+ static inline int hostapd_drv_hapd_send_eapol(struct hostapd_data *hapd,
+                                             const u8 *addr, const u8 *data,
+-                                            size_t data_len, int encrypt)
++                                            size_t data_len, int encrypt,
++                                            u32 flags)
+ {
+       if (hapd->driver == NULL || hapd->driver->hapd_send_eapol == NULL)
+               return 0;
+       return hapd->driver->hapd_send_eapol(hapd->drv_priv, addr, data,
+                                            data_len, encrypt,
+-                                           hapd->own_addr);
++                                           hapd->own_addr, flags);
+ }
+ static inline int hostapd_drv_read_sta_data(
+--- a/src/ap/ieee802_1x.c
++++ b/src/ap/ieee802_1x.c
+@@ -73,7 +73,7 @@ static void ieee802_1x_send(struct hosta
+               rsn_preauth_send(hapd, sta, buf, len);
+       } else {
+               hostapd_drv_hapd_send_eapol(hapd, sta->addr, buf, len,
+-                                          encrypt);
++                                          encrypt, sta->flags);
+       }
+       os_free(buf);
+--- a/src/ap/wpa_auth_glue.c
++++ b/src/ap/wpa_auth_glue.c
+@@ -243,8 +243,15 @@ static int hostapd_wpa_auth_send_eapol(v
+                                      int encrypt)
+ {
+       struct hostapd_data *hapd = ctx;
++      struct sta_info *sta;
++      u32 flags = 0;
++
++      sta = ap_get_sta(hapd, addr);
++      if (sta)
++              flags = sta->flags;
++
+       return hostapd_drv_hapd_send_eapol(hapd, addr, data, data_len,
+-                                         encrypt);
++                                         encrypt, flags);
+ }
+--- a/wpa_supplicant/driver_i.h
++++ b/wpa_supplicant/driver_i.h
+@@ -351,12 +351,12 @@ static inline int wpa_drv_sta_remove(str
+ static inline int wpa_drv_hapd_send_eapol(struct wpa_supplicant *wpa_s,
+                                         const u8 *addr, const u8 *data,
+                                         size_t data_len, int encrypt,
+-                                        const u8 *own_addr)
++                                        const u8 *own_addr, u32 flags)
+ {
+       if (wpa_s->driver->hapd_send_eapol)
+               return wpa_s->driver->hapd_send_eapol(wpa_s->drv_priv, addr,
+                                                     data, data_len, encrypt,
+-                                                    own_addr);
++                                                    own_addr, flags);
+       return -1;
+ }
+--- a/src/drivers/driver_wired.c
++++ b/src/drivers/driver_wired.c
+@@ -314,7 +314,7 @@ static int wired_init_sockets(struct wpa
+ static int wired_send_eapol(void *priv, const u8 *addr,
+                           const u8 *data, size_t data_len, int encrypt,
+-                          const u8 *own_addr)
++                          const u8 *own_addr, u32 flags)
+ {
+       struct wpa_driver_wired_data *drv = priv;
+       struct ieee8023_hdr *hdr;