Patchwork [3/3] Implement noack policy in nl80211

login
register
mail settings
Submitter Helmut Schaa
Date Nov. 10, 2011, 3:21 p.m.
Message ID <1320938481-23936-3-git-send-email-helmut.schaa@googlemail.com>
Download mbox | patch
Permalink /patch/124905/
State Accepted
Commit fab2533604ce0777b284b13aa866723ea4f0c648
Headers show

Comments

Helmut Schaa - Nov. 10, 2011, 3:21 p.m.
Signed-hostap: Helmut Schaa <helmut.schaa@googlemail.com>
---
 src/drivers/driver_nl80211.c |   14 ++++++++++----
 src/utils/radiotap.h         |    1 +
 2 files changed, 11 insertions(+), 4 deletions(-)
Jouni Malinen - Nov. 19, 2011, 5:36 p.m.
Thanks, applied.

Patch

diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c
index 4c806c5..84abfb8 100644
--- a/src/drivers/driver_nl80211.c
+++ b/src/drivers/driver_nl80211.c
@@ -4152,7 +4152,7 @@  wpa_driver_nl80211_get_hw_feature_data(void *priv, u16 *num_modes, u16 *flags)
 
 static int wpa_driver_nl80211_send_frame(struct wpa_driver_nl80211_data *drv,
 					 const void *data, size_t len,
-					 int encrypt)
+					 int encrypt, int noack)
 {
 	__u8 rtap_hdr[] = {
 		0x00, 0x00, /* radiotap version */
@@ -4183,6 +4183,7 @@  static int wpa_driver_nl80211_send_frame(struct wpa_driver_nl80211_data *drv,
 		.msg_flags = 0,
 	};
 	int res;
+	u16 txflags = 0;
 
 	if (encrypt)
 		rtap_hdr[8] |= IEEE80211_RADIOTAP_F_WEP;
@@ -4193,6 +4194,10 @@  static int wpa_driver_nl80211_send_frame(struct wpa_driver_nl80211_data *drv,
 		return -1;
 	}
 
+	if (noack)
+		txflags |= IEEE80211_RADIOTAP_F_TX_NOACK;
+	*(__le16 *) &rtap_hdr[12] = host_to_le16(txflags);
+
 	res = sendmsg(drv->monitor_sock, &msg, 0);
 	if (res < 0) {
 		wpa_printf(MSG_INFO, "nl80211: sendmsg: %s", strerror(errno));
@@ -4245,7 +4250,8 @@  static int wpa_driver_nl80211_send_mlme(void *priv, const u8 *data,
 			encrypt = 0;
 	}
 
-	return wpa_driver_nl80211_send_frame(drv, data, data_len, encrypt);
+	return wpa_driver_nl80211_send_frame(drv, data, data_len, encrypt,
+					     noack);
 }
 
 
@@ -5188,7 +5194,7 @@  static int wpa_driver_nl80211_hapd_send_eapol(
 	pos += 2;
 	memcpy(pos, data, data_len);
 
-	res = wpa_driver_nl80211_send_frame(drv, (u8 *) hdr, len, encrypt);
+	res = wpa_driver_nl80211_send_frame(drv, (u8 *) hdr, len, encrypt, 0);
 	if (res < 0) {
 		wpa_printf(MSG_ERROR, "i802_send_eapol - packet len: %lu - "
 			   "failed: %d (%s)",
@@ -7237,7 +7243,7 @@  static int nl80211_send_frame(void *priv, const u8 *data, size_t data_len,
 {
 	struct i802_bss *bss = priv;
 	struct wpa_driver_nl80211_data *drv = bss->drv;
-	return wpa_driver_nl80211_send_frame(drv, data, data_len, encrypt);
+	return wpa_driver_nl80211_send_frame(drv, data, data_len, encrypt, 0);
 }
 
 
diff --git a/src/utils/radiotap.h b/src/utils/radiotap.h
index 508264c..137288f 100644
--- a/src/utils/radiotap.h
+++ b/src/utils/radiotap.h
@@ -238,5 +238,6 @@  enum ieee80211_radiotap_type {
 						 * retries */
 #define IEEE80211_RADIOTAP_F_TX_CTS	0x0002	/* used cts 'protection' */
 #define IEEE80211_RADIOTAP_F_TX_RTS	0x0004	/* used rts/cts handshake */
+#define IEEE80211_RADIOTAP_F_TX_NOACK	0x0008	/* don't expect an ACK */
 
 #endif				/* IEEE80211_RADIOTAP_H */