Wireshark-dev: [Wireshark-dev] [patch] Add a1, a2, a3, a4 address fields to packet-ieee80211 di
From: Solomon Peachy <solomon@xxxxxxxxxxxxxx>
Date: Wed, 23 Aug 2006 17:38:28 -0400
This is one of those things that's been bugging me off and on for a 
couple of years now.

The problem with the 'wlan.da/wlan.sa/etc' fields is that they switch
around based on the frame type.  Sometimes we actually want to know what
the actual a1/a2/a3/a4 fields of a frame are, independently of any
higher-level interpretations.

I've attached a patch that adds wlan.a1 through wlan.a4 as hidden fields 
so we can use them in filters and whatnot. 

(A case could be made for making them visible, but duplicating the 
 address fields could be confusing.  Perhaps behind a collapsable tree 
 item?)

 - Solomon
-- 
Solomon Peachy                        solomon@xxxxxxxxxxxxxx
AbsoluteValue Systems                 http://www.linux-wlan.com
721-D North Drive                     +1 (321) 259-0737  (office)
Melbourne, FL 32934                   +1 (321) 259-0286  (fax)
Index: epan/dissectors/packet-ieee80211.c
===================================================================
--- epan/dissectors/packet-ieee80211.c	(revision 19007)
+++ epan/dissectors/packet-ieee80211.c	(working copy)
@@ -516,6 +516,10 @@
 static int hf_addr_sa = -1;	/* Source address subfield */
 static int hf_addr_ra = -1;	/* Receiver address subfield */
 static int hf_addr_ta = -1;	/* Transmitter address subfield */
+static int hf_addr_a1 = -1;	/* Address 1 subfield */
+static int hf_addr_a2 = -1;	/* Address 2 subfield */
+static int hf_addr_a3 = -1;	/* Address 3 subfield */
+static int hf_addr_a4 = -1;	/* Address 4 subfield */
 static int hf_addr_bssid = -1;	/* address is bssid */
 
 static int hf_addr = -1;	/* Source or destination address subfield */
@@ -2443,6 +2447,12 @@
 	  proto_tree_add_ether (hdr_tree, hf_addr_bssid, tvb, 16, 6,
 				tvb_get_ptr (tvb, 16, 6));
 
+	  /* A1, A2, A3 are on all mgmt frames */
+	  proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, dst);
+	  proto_tree_add_ether_hidden(hdr_tree, hf_addr_a2, tvb, 10, 6, src);
+	  proto_tree_add_ether_hidden(hdr_tree, hf_addr_a3, tvb, 16, 6, 
+				      tvb_get_ptr (tvb, 16, 6));
+
 	  proto_tree_add_uint (hdr_tree, hf_frag_number, tvb, 22, 2,
 			       frag_number);
 
@@ -2481,8 +2491,10 @@
 	  if (tree)
 	    {
 	      proto_tree_add_ether (hdr_tree, hf_addr_ra, tvb, 4, 6, dst);
+	      proto_tree_add_ether (hdr_tree, hf_addr_ta, tvb, 10, 6, src);
 
-	      proto_tree_add_ether (hdr_tree, hf_addr_ta, tvb, 10, 6, src);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, dst);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a2, tvb, 10, 6, src);
 	    }
 	  break;
 
@@ -2492,8 +2504,12 @@
 
 	  set_dst_addr_cols(pinfo, dst, "RA");
 
-	  if (tree)
+	  if (tree) {
 	    proto_tree_add_ether (hdr_tree, hf_addr_ra, tvb, 4, 6, dst);
+
+	    proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, dst);
+	  }
+
 	  break;
 
 
@@ -2502,8 +2518,11 @@
 
 	  set_dst_addr_cols(pinfo, dst, "RA");
 
-	  if (tree)
+	  if (tree) {
 	    proto_tree_add_ether (hdr_tree, hf_addr_ra, tvb, 4, 6, dst);
+
+	    proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, dst);
+	  }
 	  break;
 
 
@@ -2518,6 +2537,9 @@
 	    {
 	      proto_tree_add_ether (hdr_tree, hf_addr_ra, tvb, 4, 6, dst);
 	      proto_tree_add_ether (hdr_tree, hf_addr_bssid, tvb, 10, 6, src);
+
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, dst);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a2, tvb, 10, 6, src);
 	    }
 	  break;
 
@@ -2532,8 +2554,10 @@
 	  if (tree)
 	    {
 	      proto_tree_add_ether (hdr_tree, hf_addr_ra, tvb, 4, 6, dst);
+	      proto_tree_add_ether (hdr_tree, hf_addr_bssid, tvb, 10, 6, src);
 
-	      proto_tree_add_ether (hdr_tree, hf_addr_bssid, tvb, 10, 6, src);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, dst);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a2, tvb, 10, 6, src);
 	    }
 	  break;
 
@@ -2548,8 +2572,10 @@
 	    if (tree)
 	    {
 	      proto_tree_add_ether (hdr_tree, hf_addr_ra, tvb, 4, 6, src);
+	      proto_tree_add_ether (hdr_tree, hf_addr_ta, tvb, 10, 6, dst);
 
-	      proto_tree_add_ether (hdr_tree, hf_addr_ta, tvb, 10, 6, dst);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, src);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a2, tvb, 10, 6, dst);
 	    }
 	  /* TODO BAR */
 	  break;
@@ -2566,8 +2592,10 @@
 	    if (tree)
 	    {
 	      proto_tree_add_ether (hdr_tree, hf_addr_ra, tvb, 4, 6, src);
+	      proto_tree_add_ether (hdr_tree, hf_addr_ta, tvb, 10, 6, dst);
 
-	      proto_tree_add_ether (hdr_tree, hf_addr_ta, tvb, 10, 6, dst);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, src);
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a2, tvb, 10, 6, dst);
 	    }
 	    /* TODO BAR Format */
 	    break;
@@ -2638,11 +2666,16 @@
       /* Now if we have a tree we start adding stuff */
       if (tree)
 	{
+	  /* A1, A2, A3 are on all data frames */
+	  proto_tree_add_ether_hidden(hdr_tree, hf_addr_a1, tvb, 4, 6, 
+				      tvb_get_ptr (tvb, 4, 6));
+	  proto_tree_add_ether_hidden(hdr_tree, hf_addr_a2, tvb, 10, 6, 
+				      tvb_get_ptr (tvb, 10, 6));
+	  proto_tree_add_ether_hidden(hdr_tree, hf_addr_a3, tvb, 16, 6, 
+				      tvb_get_ptr (tvb, 16, 6));
 
-
 	  switch (addr_type)
 	    {
-
 	    case DATA_ADDR_T1:
 	      proto_tree_add_ether (hdr_tree, hf_addr_da, tvb, 4, 6, dst);
 	      proto_tree_add_ether (hdr_tree, hf_addr_sa, tvb, 10, 6, src);
@@ -2704,6 +2737,10 @@
 				   seq_number);
 	      proto_tree_add_ether (hdr_tree, hf_addr_sa, tvb, 24, 6, src);
 
+	      /* Add A4 address */
+	      proto_tree_add_ether_hidden(hdr_tree, hf_addr_a4, tvb, 24, 6, 
+					  tvb_get_ptr (tvb, 24, 6));
+
 	      /* add items for wlan.addr filter */
 	      proto_tree_add_ether_hidden(hdr_tree, hf_addr, tvb, 16, 6, dst);
 	      proto_tree_add_ether_hidden(hdr_tree, hf_addr, tvb, 24, 6, src);
@@ -3716,6 +3753,22 @@
      {"BSS Id", "wlan.bssid", FT_ETHER, BASE_NONE, NULL, 0,
       "Basic Service Set ID", HFILL }},
 
+    {&hf_addr_a1,
+     {"Address 1", "wlan.a1", FT_ETHER, BASE_NONE, NULL, 0,
+      "Address 1 of the 802.11 packet", HFILL }},
+
+    {&hf_addr_a2,
+     {"Address 2", "wlan.a2", FT_ETHER, BASE_NONE, NULL, 0,
+      "Address 2 of the 802.11 packet", HFILL }},
+
+    {&hf_addr_a3,
+     {"Address 3", "wlan.a3", FT_ETHER, BASE_NONE, NULL, 0,
+      "Address 3 of the 802.11 packet", HFILL }},
+
+    {&hf_addr_a4,
+     {"Address 4", "wlan.a4", FT_ETHER, BASE_NONE, NULL, 0,
+      "Address 4 of the 802.11 packet", HFILL }},
+
     {&hf_frag_number,
      {"Fragment number", "wlan.frag", FT_UINT16, BASE_DEC, NULL, 0,
       "Fragment number", HFILL }},

Attachment: pgpPioBP6NktV.pgp
Description: PGP signature