[PATCH 2/2] wlantest: tag and ignore generated packets
Johannes Berg
johannes
Wed Apr 9 02:53:16 PDT 2014
From: Johannes Berg <johannes.berg at intel.com>
Rather than ignoring packets with a minimal 8-byte radiotap
header, which may occur elsewhere, tag generated (decrypted)
packets with an empty vendor namespace tag and ignore those.
Signed-off-by: Johannes Berg <johannes.berg at intel.com>
---
src/common/qca-vendor.h | 7 +++++++
wlantest/process.c | 15 ++++++++++-----
wlantest/writepcap.c | 7 +++++--
3 files changed, 22 insertions(+), 7 deletions(-)
diff --git a/src/common/qca-vendor.h b/src/common/qca-vendor.h
index cea47017f844..0e292e67ced6 100644
--- a/src/common/qca-vendor.h
+++ b/src/common/qca-vendor.h
@@ -19,6 +19,13 @@
#define OUI_QCA 0x001374
/**
+ * enum qca_radiotap_vendor_ids - QCA radiotap vendor namespace IDs
+ */
+enum qca_radiotap_vendor_ids {
+ QCA_RADIOTAP_VID_WLANTEST = 0,
+};
+
+/**
* enum qca_nl80211_vendor_subcmds - QCA nl80211 vendor command identifiers
*
* @QCA_NL80211_VENDOR_SUBCMD_UNSPEC: Reserved value 0
diff --git a/wlantest/process.c b/wlantest/process.c
index 83602f65724c..85d3b0c4d011 100644
--- a/wlantest/process.c
+++ b/wlantest/process.c
@@ -12,6 +12,7 @@
#include "utils/radiotap.h"
#include "utils/radiotap_iter.h"
#include "common/ieee802_11_defs.h"
+#include "common/qca-vendor.h"
#include "wlantest.h"
@@ -305,14 +306,18 @@ void wlantest_process(struct wlantest *wt, const u8 *data, size_t len)
failed = le_to_host16((*(u16 *) iter.this_arg)) &
IEEE80211_RADIOTAP_F_TX_FAIL;
break;
-
+ case IEEE80211_RADIOTAP_VENDOR_NAMESPACE:
+ if (iter.this_arg[0] == 0x00 &&
+ iter.this_arg[1] == 0x13 &&
+ iter.this_arg[2] == 0x74 &&
+ iter.this_arg[3] == QCA_RADIOTAP_VID_WLANTEST) {
+ add_note(wt, MSG_DEBUG,
+ "Skip frame inserted by wlantest");
+ return;
+ }
}
}
- if (iter.max_length == 8) {
- add_note(wt, MSG_DEBUG, "Skip frame inserted by wlantest");
- return;
- }
frame = data + iter._max_length;
frame_len = len - iter._max_length;
diff --git a/wlantest/writepcap.c b/wlantest/writepcap.c
index 58f01a056f34..28b306b7a1ac 100644
--- a/wlantest/writepcap.c
+++ b/wlantest/writepcap.c
@@ -12,6 +12,7 @@
#include "utils/common.h"
#include "wlantest.h"
+#include "common/qca-vendor.h"
int write_pcap_init(struct wlantest *wt, const char *fname)
@@ -68,8 +69,10 @@ void write_pcap_decrypted(struct wlantest *wt, const u8 *buf1, size_t len1,
u8 rtap[] = {
0x00 /* rev */,
0x00 /* pad */,
- 0x08, 0x00, /* header len */
- 0x00, 0x00, 0x00, 0x00 /* present flags */
+ 0x0e, 0x00, /* header len */
+ 0x00, 0x00, 0x00, 0x40, /* present flags */
+ 0x00, 0x13, 0x74, QCA_RADIOTAP_VID_WLANTEST,
+ 0x00, 0x00
};
u8 *buf;
size_t len;
--
1.9.0
More information about the Hostap
mailing list