Parcourir la source

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.
Jouni Malinen il y a 16 ans
Parent
commit
9b71728bba
4 fichiers modifiés avec 9 ajouts et 20 suppressions
  1. 9 4
      hostapd/driver_hostap.c
  2. 0 6
      hostapd/driver_nl80211.c
  3. 0 9
      hostapd/ieee802_11.c
  4. 0 1
      hostapd/sta_info.c

+ 9 - 4
hostapd/driver_hostap.c

@@ -324,8 +324,15 @@ static int hostap_send_mgmt_frame(void *priv, const void *msg, size_t len,
 				  int flags)
 {
 	struct hostap_driver_data *drv = priv;
-	
-	return send(drv->sock, msg, len, flags);
+	struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) msg;
+	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 =
 		IEEE80211_FC(WLAN_FC_TYPE_DATA, WLAN_FC_STYPE_DATA);
 	hdr->frame_control |= host_to_le16(WLAN_FC_FROMDS);
-	/* Request TX callback */
-	hdr->frame_control |= host_to_le16(BIT(1));
 	if (encrypt)
 		hdr->frame_control |= host_to_le16(WLAN_FC_ISWEP);
 	memcpy(hdr->IEEE80211_DA_FROMDS, addr, ETH_ALEN);

+ 0 - 6
hostapd/driver_nl80211.c

@@ -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);
 }
 

+ 0 - 9
hostapd/ieee802_11.c

@@ -569,8 +569,6 @@ static void ieee802_11_sta_authenticate(void *eloop_ctx, void *timeout_ctx)
 	os_memset(&mgmt, 0, sizeof(mgmt));
 	mgmt.frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
 					  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.sa, hapd->own_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));
 	mgmt->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
 					  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->sa, hapd->own_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->frame_control = IEEE80211_FC(WLAN_FC_TYPE_MGMT,
 					    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->sa, hapd->own_addr, ETH_ALEN);
 	os_memcpy(reply->bssid, bssid, ETH_ALEN);
@@ -1390,9 +1384,6 @@ static void handle_assoc(struct hostapd_data *hapd,
 #endif /* CONFIG_IEEE80211W */
 
 		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)

+ 0 - 1
hostapd/sta_info.c

@@ -279,7 +279,6 @@ void ap_handle_timer(void *eloop_ctx, void *timeout_ctx)
 		os_memset(&hdr, 0, sizeof(hdr));
 		hdr.frame_control =
 			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);
 		os_memcpy(hdr.IEEE80211_DA_FROMDS, sta->addr, ETH_ALEN);
 		os_memcpy(hdr.IEEE80211_BSSID_FROMDS, hapd->own_addr,