Wireshark-dev: [Wireshark-dev] A small fix to ensure that display filter expressions work for 8
From: Richard Sharpe <[email protected]>
Date: Sun, 23 Aug 2015 20:31:33 -0700
Hi folks,

Attached is a small patch to fix the problems I saw with filter expressions.

It is a quick simple fix although I think the whole 802.11 dissector
needs a cleanup and the check should possibly be based on the PHY
Type.

-- 
Regards,
Richard Sharpe
(何以解憂?唯有杜康。--曹操)
diff --git a/epan/dissectors/packet-ieee80211.c b/epan/dissectors/packet-ieee80211.c
index e29e77e..642ee7d 100644
--- a/epan/dissectors/packet-ieee80211.c
+++ b/epan/dissectors/packet-ieee80211.c
@@ -285,32 +285,8 @@ typedef struct mimo_control
  * Checks if the packet was transmitted in channel frequency of MINIMAL_80211AD_FREQ
  * till MAXIMAL_80211AD_FREQ to determine if 802.11ad.
  */
-static gboolean is_80211ad(proto_node * pnode, gpointer data) {
-    field_info* finfo;
-    header_field_info* hfinfo;
-    if(data != NULL) {
-      return FALSE;
-    }
-    if(pnode == NULL) {
-      return FALSE;
-    }
-    finfo = PNODE_FINFO(pnode);
-    if (finfo == NULL) {
-      return FALSE;
-    }
-    hfinfo = finfo->hfinfo;
-    if (hfinfo == NULL) {
-      return FALSE;
-    }
-    if(hfinfo->name != NULL) {
-      if(strcmp(hfinfo->name, "Channel frequency") == 0) {
-        if((finfo->value.value.uinteger >= MINIMAL_80211AD_FREQ) && (finfo->value.value.uinteger <= MAXIMAL_80211AD_FREQ)) {
-          return TRUE;
-        }
-      }
-    }
-    return FALSE;
-}
+#define IS_80211AD(frequency) (((frequency) >= MINIMAL_80211AD_FREQ) && \
+                               ((frequency) <= MAXIMAL_80211AD_FREQ))
 
 /*
  * Extract the fragment number and sequence number from the sequence
@@ -16589,7 +16565,7 @@ dissect_ieee80211_common (tvbuff_t *tvb, packet_info *pinfo,
   guint16          meshoff     = 0;
   static wlan_hdr  whdrs[4];
   gboolean         retransmitted;
-  gboolean         isDMG = (tree == NULL) ? FALSE : proto_tree_traverse_post_order(proto_tree_get_root(tree), is_80211ad, NULL);
+  gboolean         isDMG = (phdr ? IS_80211AD(phdr->frequency) : FALSE);
 
   volatile encap_t encap_type;
   proto_tree *volatile hdr_tree = NULL;