From fab2533604ce0777b284b13aa866723ea4f0c648 Mon Sep 17 00:00:00 2001 From: Helmut Schaa Date: Sat, 19 Nov 2011 19:22:13 +0200 Subject: [PATCH] nl80211: Implement noack policy for send_mlme Signed-hostap: Helmut Schaa --- src/drivers/driver_nl80211.c | 14 ++++++++++---- src/utils/radiotap.h | 1 + 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/drivers/driver_nl80211.c b/src/drivers/driver_nl80211.c index 4884d62d9..1c71948cc 100644 --- a/src/drivers/driver_nl80211.c +++ b/src/drivers/driver_nl80211.c @@ -4158,7 +4158,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 */ @@ -4189,6 +4189,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; @@ -4199,6 +4200,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)); @@ -4251,7 +4256,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); } @@ -5211,7 +5217,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)", @@ -7300,7 +7306,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 508264c4c..137288f9a 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 */