Cleaned up TX callback request processing
[wpasupplicant] / hostapd / driver_nl80211.c
index 836ed42..f8c83e1 100644 (file)
@@ -408,7 +408,6 @@ static int i802_set_ssid(const char *ifname, void *priv, const u8 *buf,
 static int i802_send_mgmt_frame(void *priv, const void *data, size_t len,
                                int flags)
 {
-       struct ieee80211_hdr *hdr = (void*) data;
        __u8 rtap_hdr[] = {
                0x00, 0x00, /* radiotap version */
                0x0e, 0x00, /* radiotap length */
@@ -439,11 +438,6 @@ static int i802_send_mgmt_frame(void *priv, const void *data, size_t len,
                .msg_flags = 0,
        };
 
-       /*
-        * ugh, guess what, the generic code sets one of the version
-        * bits to request tx callback
-        */
-       hdr->frame_control &= ~host_to_le16(BIT(1));
        return sendmsg(drv->monitor_sock, &msg, flags);
 }
 
@@ -790,9 +784,8 @@ static int i802_send_eapol(void *priv, const u8 *addr, const u8 *data,
 }
 
 
-static int i802_sta_add(const char *ifname, void *priv, const u8 *addr,
-                       u16 aid, u16 capability, u8 *supp_rates,
-                       size_t supp_rates_len, int flags, u16 listen_interval)
+static int i802_sta_add2(const char *ifname, void *priv,
+                        struct hostapd_sta_add_params *params)
 {
        struct i802_driver_data *drv = priv;
        struct nl_msg *msg;
@@ -807,11 +800,22 @@ static int i802_sta_add(const char *ifname, void *priv, const u8 *addr,
 
        NLA_PUT_U32(msg, NL80211_ATTR_IFINDEX,
                    if_nametoindex(drv->iface));
-       NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, addr);
-       NLA_PUT_U16(msg, NL80211_ATTR_STA_AID, aid);
-       NLA_PUT(msg, NL80211_ATTR_STA_SUPPORTED_RATES, supp_rates_len,
-               supp_rates);
-       NLA_PUT_U16(msg, NL80211_ATTR_STA_LISTEN_INTERVAL, listen_interval);
+       NLA_PUT(msg, NL80211_ATTR_MAC, ETH_ALEN, params->addr);
+       NLA_PUT_U16(msg, NL80211_ATTR_STA_AID, params->aid);
+       NLA_PUT(msg, NL80211_ATTR_STA_SUPPORTED_RATES, params->supp_rates_len,
+               params->supp_rates);
+       NLA_PUT_U16(msg, NL80211_ATTR_STA_LISTEN_INTERVAL,
+                   params->listen_interval);
+
+#ifdef CONFIG_IEEE80211N
+#ifdef NL80211_ATTR_HT_CAPABILITY
+       if (params->ht_capabilities) {
+               NLA_PUT(msg, NL80211_ATTR_HT_CAPABILITY,
+                       params->ht_capabilities->length,
+                       &params->ht_capabilities->data);
+       }
+#endif /* NL80211_ATTR_HT_CAPABILITY */
+#endif /* CONFIG_IEEE80211N */
 
        ret = nl_send_auto_complete(drv->nl_handle, msg);
        if (ret < 0)
@@ -2448,7 +2452,7 @@ const struct wpa_driver_ops wpa_driver_nl80211_ops = {
        .sta_remove = i802_sta_remove,
        .set_ssid = i802_set_ssid,
        .send_mgmt_frame = i802_send_mgmt_frame,
-       .sta_add = i802_sta_add,
+       .sta_add2 = i802_sta_add2,
        .get_inact_sec = i802_get_inact_sec,
        .sta_clear_stats = i802_sta_clear_stats,
        .set_freq = i802_set_freq,