]> The Tcpdump Group git mirrors - tcpdump/commitdiff
Handle version 2 of the AVS header.
authorguy <guy>
Sat, 29 Dec 2007 23:25:02 +0000 (23:25 +0000)
committerguy <guy>
Sat, 29 Dec 2007 23:25:02 +0000 (23:25 +0000)
print-802_11.c

index 99a3f8eaf95db501ea4d72150c1f052313417bba..8cab17c0e5519a31c99bd4cf57455f095b10cd76 100644 (file)
@@ -22,7 +22,7 @@
 
 #ifndef lint
 static const char rcsid[] _U_ =
-    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.48 2007-12-20 08:13:35 guy Exp $ (LBL)";
+    "@(#) $Header: /tcpdump/master/tcpdump/print-802_11.c,v 1.49 2007-12-29 23:25:02 guy Exp $ (LBL)";
 #endif
 
 #ifdef HAVE_CONFIG_H
@@ -1236,32 +1236,38 @@ ieee802_11_avs_radio_print(const u_char *p, u_int length, u_int caplen)
 
 #define PRISM_HDR_LEN          144
 
+#define WLANCAP_MAGIC_COOKIE_BASE 0x80211000
 #define WLANCAP_MAGIC_COOKIE_V1        0x80211001
+#define WLANCAP_MAGIC_COOKIE_V2        0x80211002
 
 /*
  * For DLT_PRISM_HEADER; like DLT_IEEE802_11, but with an extra header,
  * containing information such as radio information, which we
  * currently ignore.
  *
- * If, however, the packet begins with WLANCAP_MAGIC_COOKIE_V1, it's
- * really DLT_IEEE802_11_RADIO (currently, on Linux, there's no
- * ARPHRD_ type for DLT_IEEE802_11_RADIO, as there is a
- * ARPHRD_IEEE80211_PRISM for DLT_PRISM_HEADER, so
- * ARPHRD_IEEE80211_PRISM is used for DLT_IEEE802_11_RADIO, and
- * the first 4 bytes of the header are used to indicate which it is).
+ * If, however, the packet begins with WLANCAP_MAGIC_COOKIE_V1 or
+ * WLANCAP_MAGIC_COOKIE_V2, it's really DLT_IEEE802_11_RADIO_AVS
+ * (currently, on Linux, there's no ARPHRD_ type for
+ * DLT_IEEE802_11_RADIO_AVS, as there is a ARPHRD_IEEE80211_PRISM
+ * for DLT_PRISM_HEADER, so ARPHRD_IEEE80211_PRISM is used for
+ * the AVS header, and the first 4 bytes of the header are used to
+ * indicate whether it's a Prism header or an AVS header).
  */
 u_int
 prism_if_print(const struct pcap_pkthdr *h, const u_char *p)
 {
        u_int caplen = h->caplen;
        u_int length = h->len;
+       u_int32_t msgcode;
 
        if (caplen < 4) {
                printf("[|802.11]");
                return caplen;
        }
 
-       if (EXTRACT_32BITS(p) == WLANCAP_MAGIC_COOKIE_V1)
+       msgcode = EXTRACT_32BITS(p);
+       if (msgcode == WLANCAP_MAGIC_COOKIE_V1 ||
+           msgcode == WLANCAP_MAGIC_COOKIE_V2)
                return ieee802_11_avs_radio_print(p, length, caplen);
 
        if (caplen < PRISM_HDR_LEN) {