Cleaned up TX callback request processing

Move the use of 802.11 header protocol field into driver_hostap.c since
this is a Host AP driver specific mechanism and other driver wrappers
should not really need to know about it.
This commit is contained in:
Jouni Malinen 2008-08-31 11:15:56 +03:00
parent c2a714088d
commit 9b71728bba
4 changed files with 9 additions and 20 deletions

View file

@ -324,8 +324,15 @@ static int hostap_send_mgmt_frame(void *priv, const void *msg, size_t len,
int flags) int flags)
{ {
struct hostap_driver_data *drv = priv; struct hostap_driver_data *drv = priv;
struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) msg;
return send(drv->sock, msg, len, flags); int res;
/* Request TX callback */
hdr->frame_control |= host_to_le16(BIT(1));
res = send(drv->sock, msg, len, flags);
hdr->frame_control &= ~host_to_le16(BIT(1));
return res;
} }
@ -349,8 +356,6 @@ static int hostap_send_eapol(void *priv, const u8 *addr, const u8 *data,
hdr->frame_control = hdr->frame_control =
IEEE80211_FC(WLAN_FC_TYPE_DATA, WLAN_FC_STYPE_DATA); IEEE80211_FC(WLAN_FC_TYPE_DATA, WLAN_FC_STYPE_DATA);
hdr->frame_control |= host_to_le16(WLAN_FC_FROMDS); hdr->frame_control |= host_to_le16(WLAN_FC_FROMDS);
/* Request TX callback */
hdr->frame_control |= host_to_le16(BIT(1));
if (encrypt) if (encrypt)
hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP); hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP);
memcpy(hdr->IEEE80211_DA_FROMDS, addr, ETH_ALEN); memcpy(hdr->IEEE80211_DA_FROMDS, addr, ETH_ALEN);

View 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, static int i802_send_mgmt_frame(void *priv, const void *data, size_t len,
int flags) int flags)
{ {
struct ieee80211_hdr *hdr = (void*) data;
__u8 rtap_hdr[] = { __u8 rtap_hdr[] = {
0x00, 0x00, /* radiotap version */ 0x00, 0x00, /* radiotap version */
0x0e, 0x00, /* radiotap length */ 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, .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); return sendmsg(drv->monitor_sock, &msg, flags);
} }

View file

@ -569,8 +569,6 @@ static void ieee802_11_sta_authenticate(void *eloop_ctx, void *timeout_ctx)
os_memset(&mgmt, 0, sizeof(mgmt)); os_memset(&mgmt, 0, sizeof(mgmt));
mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
WLAN_FC_STYPE_AUTH); WLAN_FC_STYPE_AUTH);
/* Request TX callback */
mgmt.frame_control |= host_to_le16(BIT(1));
os_memcpy(mgmt.da, hapd->conf->assoc_ap_addr, ETH_ALEN); os_memcpy(mgmt.da, hapd->conf->assoc_ap_addr, ETH_ALEN);
os_memcpy(mgmt.sa, hapd->own_addr, ETH_ALEN); os_memcpy(mgmt.sa, hapd->own_addr, ETH_ALEN);
os_memcpy(mgmt.bssid, hapd->conf->assoc_ap_addr, ETH_ALEN); os_memcpy(mgmt.bssid, hapd->conf->assoc_ap_addr, ETH_ALEN);
@ -607,8 +605,6 @@ static void ieee802_11_sta_associate(void *eloop_ctx, void *timeout_ctx)
os_memset(mgmt, 0, sizeof(*mgmt)); os_memset(mgmt, 0, sizeof(*mgmt));
mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
WLAN_FC_STYPE_ASSOC_REQ); WLAN_FC_STYPE_ASSOC_REQ);
/* Request TX callback */
mgmt->frame_control |= host_to_le16(BIT(1));
os_memcpy(mgmt->da, hapd->conf->assoc_ap_addr, ETH_ALEN); os_memcpy(mgmt->da, hapd->conf->assoc_ap_addr, ETH_ALEN);
os_memcpy(mgmt->sa, hapd->own_addr, ETH_ALEN); os_memcpy(mgmt->sa, hapd->own_addr, ETH_ALEN);
os_memcpy(mgmt->bssid, hapd->conf->assoc_ap_addr, ETH_ALEN); os_memcpy(mgmt->bssid, hapd->conf->assoc_ap_addr, ETH_ALEN);
@ -707,8 +703,6 @@ static void send_auth_reply(struct hostapd_data *hapd,
reply = (struct ieee80211_mgmt *) buf; reply = (struct ieee80211_mgmt *) buf;
reply->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT, reply->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
WLAN_FC_STYPE_AUTH); WLAN_FC_STYPE_AUTH);
/* Request TX callback */
reply->frame_control |= host_to_le16(BIT(1));
os_memcpy(reply->da, dst, ETH_ALEN); os_memcpy(reply->da, dst, ETH_ALEN);
os_memcpy(reply->sa, hapd->own_addr, ETH_ALEN); os_memcpy(reply->sa, hapd->own_addr, ETH_ALEN);
os_memcpy(reply->bssid, bssid, ETH_ALEN); os_memcpy(reply->bssid, bssid, ETH_ALEN);
@ -1390,9 +1384,6 @@ static void handle_assoc(struct hostapd_data *hapd,
#endif /* CONFIG_IEEE80211W */ #endif /* CONFIG_IEEE80211W */
send_len += p - reply->u.assoc_resp.variable; send_len += p - reply->u.assoc_resp.variable;
/* Request TX callback */
reply->frame_control |= host_to_le16(BIT(1));
} }
if (hostapd_send_mgmt_frame(hapd, reply, send_len, 0) < 0) if (hostapd_send_mgmt_frame(hapd, reply, send_len, 0) < 0)

View file

@ -279,7 +279,6 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
os_memset(&hdr, 0, sizeof(hdr)); os_memset(&hdr, 0, sizeof(hdr));
hdr.frame_control = hdr.frame_control =
IEEE80211_FC(WLAN_FC_TYPE_DATA, WLAN_FC_STYPE_DATA); IEEE80211_FC(WLAN_FC_TYPE_DATA, WLAN_FC_STYPE_DATA);
hdr.frame_control |= host_to_le16(BIT(1));
hdr.frame_control |= host_to_le16(WLAN_FC_FROMDS); hdr.frame_control |= host_to_le16(WLAN_FC_FROMDS);
os_memcpy(hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN); os_memcpy(hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN);
os_memcpy(hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr, os_memcpy(hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr,