]> git.ipfire.org Git - thirdparty/hostap.git/commitdiff
wlantest: Tag and ignore generated packets
authorJohannes Berg <johannes.berg@intel.com>
Wed, 9 Apr 2014 09:53:16 +0000 (11:53 +0200)
committerJouni Malinen <j@w1.fi>
Sun, 13 Apr 2014 20:54:25 +0000 (23:54 +0300)
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@intel.com>
src/common/qca-vendor.h
wlantest/process.c
wlantest/writepcap.c

index cea47017f844e8cba09354795289417e7b4f4877..0e292e67ced61c007ea9a3fe12d96d20f063f14e 100644 (file)
 
 #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
  *
index c2279adf5fc860ca0d508647741ef44243271150..802d0af8ff34ae0a0f0bed3c24666934cdf843dd 100644 (file)
@@ -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,16 @@ 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 (WPA_GET_BE24(iter.this_arg) == OUI_QCA &&
+                           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;
 
index 58f01a056f34b8f6d40d918dfa0905ca122fd7af..28b306b7a1ac27e4341c4aa4b94cea840fce78d3 100644 (file)
@@ -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;