Browse Source

wlantest: Add support for reading DLT_IEEE802_11 pcap files

Jouni Malinen 14 years ago
parent
commit
0f3e4f2a83
3 changed files with 12 additions and 1 deletions
  1. 7 0
      wlantest/process.c
  2. 4 1
      wlantest/readpcap.c
  3. 1 0
      wlantest/wlantest.h

+ 7 - 0
wlantest/process.c

@@ -262,3 +262,10 @@ void wlantest_process_prism(struct wlantest *wt, const u8 *data, size_t len)
 
 	rx_frame(wt, frame, frame_len);
 }
+
+
+void wlantest_process_80211(struct wlantest *wt, const u8 *data, size_t len)
+{
+	wpa_hexdump(MSG_EXCESSIVE, "Process data", data, len);
+	rx_frame(wt, data, len);
+}

+ 4 - 1
wlantest/readpcap.c

@@ -36,7 +36,8 @@ int read_cap_file(struct wlantest *wt, const char *fname)
 		return -1;
 	}
 	dlt = pcap_datalink(pcap);
-	if (dlt != DLT_IEEE802_11_RADIO && dlt != DLT_PRISM_HEADER) {
+	if (dlt != DLT_IEEE802_11_RADIO && dlt != DLT_PRISM_HEADER &&
+	    dlt != DLT_IEEE802_11) {
 		wpa_printf(MSG_ERROR, "Unsupported pcap datalink type: %d",
 			   dlt);
 		pcap_close(pcap);
@@ -82,6 +83,8 @@ int read_cap_file(struct wlantest *wt, const char *fname)
 		case DLT_PRISM_HEADER:
 			wlantest_process_prism(wt, data, hdr->caplen);
 			break;
+		case DLT_IEEE802_11:
+			wlantest_process_80211(wt, data, hdr->caplen);
 		}
 	}
 

+ 1 - 0
wlantest/wlantest.h

@@ -155,6 +155,7 @@ void write_pcap_decrypted(struct wlantest *wt, const u8 *buf1, size_t len1,
 			  const u8 *buf2, size_t len2);
 void wlantest_process(struct wlantest *wt, const u8 *data, size_t len);
 void wlantest_process_prism(struct wlantest *wt, const u8 *data, size_t len);
+void wlantest_process_80211(struct wlantest *wt, const u8 *data, size_t len);
 void wlantest_process_wired(struct wlantest *wt, const u8 *data, size_t len);
 u32 crc32(const u8 *frame, size_t frame_len);
 int monitor_init(struct wlantest *wt, const char *ifname);