Ethereal-dev: [Ethereal-dev] Patch for IEEE 802.11g/D6.1 changes / packet-ieee80211.c

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Jouni Malinen <jkmaline@xxxxxxxxx>
Date: Tue, 21 Jan 2003 19:18:12 -0800
Attached patch adds support for two new 802.11 elements used in the
latest IEEE 802.11g draft version: ERP Information and Extended Support
Rates. In addition, it adds two new capabilities flags. These flags
might need some finetuning since proto_tree_add_boolean() seems to show
only 8 bits and these new bits are from the other part of the 16-bit
value..

-- 
Jouni Malinen                                            PGP id EFC895FA
Index: packet-ieee80211.c
===================================================================
RCS file: /cvsroot/ethereal/packet-ieee80211.c,v
retrieving revision 1.79
diff -u -r1.79 packet-ieee80211.c
--- packet-ieee80211.c	2002/12/19 11:22:23	1.79
+++ packet-ieee80211.c	2003/01/21 19:17:24
@@ -222,6 +222,8 @@
 #define TAG_TIM            0x05
 #define TAG_IBSS_PARAMETER 0x06
 #define TAG_CHALLENGE_TEXT 0x10
+#define TAG_ERP_INFO       0x2F
+#define TAG_EXT_SUPP_RATES 0x32
 
 /* ************************************************************************* */
 /*                         Frame types, and their names                      */
@@ -354,6 +356,8 @@
 static int ff_cf_preamble = -1;
 static int ff_cf_pbcc = -1;
 static int ff_cf_agility = -1;
+static int ff_short_slot_time = -1;
+static int ff_dsss_ofdm = -1;
 
 /* ************************************************************************* */
 /*                       Tagged value format fields                          */
@@ -616,6 +620,10 @@
 			      capability);
       proto_tree_add_boolean (cap_tree, ff_cf_agility, tvb, offset, 1,
 			      capability);
+      proto_tree_add_boolean (cap_tree, ff_short_slot_time, tvb, offset + 1, 1,
+			      capability);
+      proto_tree_add_boolean (cap_tree, ff_dsss_ofdm, tvb, offset + 1, 1,
+			      capability);
       if (ESS_SET (capability) != 0)	/* This is an AP */
 	proto_tree_add_uint (cap_tree, ff_cf_ap_poll, tvb, offset, 2,
 			     ((capability & 0xC) >> 2));
@@ -689,7 +697,8 @@
 
   /* Next See if tag is reserved - if true, skip it! */
   if (((tag_no >= 7) && (tag_no <= 15))
-      || ((tag_no >= 32) && (tag_no <= 255)))
+      || ((tag_no >= 32) && (tag_no <= 255) && (tag_no != TAG_ERP_INFO) &&
+	  (tag_no != TAG_EXT_SUPP_RATES)))
     {
       proto_tree_add_uint_format (tree, tag_number, tvb, offset, 1, tag_no,
 				  "Tag Number: %u (Reserved tag number)",
@@ -726,8 +735,12 @@
 
 
     case TAG_SUPP_RATES:
+    case TAG_EXT_SUPP_RATES:
       proto_tree_add_uint_format (tree, tag_number, tvb, offset, 1, tag_no,
-				  "Tag Number: %u (Supported Rates)", tag_no);
+				  "Tag Number: %u (%sSupported Rates)",
+				  tag_no,
+				  tag_no == TAG_EXT_SUPP_RATES ? "Extended " :
+				  "");
 
       proto_tree_add_uint (tree, tag_length, tvb, offset + 1, 1, tag_len);
 
@@ -852,6 +865,27 @@
 
       break;
 
+
+
+    case TAG_ERP_INFO:
+      proto_tree_add_uint_format (tree, tag_number, tvb, offset, 1, tag_no,
+				  "Tag Number: %u (ERP Information)",
+				  tag_no);
+
+      proto_tree_add_uint (tree, tag_length, tvb, offset + 1, 1, tag_len);
+      memset (out_buff, 0, SHORT_STR);
+
+      snprintf (out_buff, SHORT_STR,
+		"ERP info: 0x%x (%sNon-ERP STAs, %suse protection)",
+		tag_data_ptr[0],
+		tag_data_ptr[0] & 0x01 ? "" : "no ",
+		tag_data_ptr[0] & 0x02 ? "" : "do not ");
+      proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2,
+			     tag_len, out_buff);
+      break;
+
+
+
     default:
       return 0;
     }
@@ -1956,7 +1990,17 @@
     "Channel agility not in use"
   };
 
+  static const true_false_string short_slot_time_flags = {
+    "Short slot time in use",
+    "Short slot time not in use"
+  };
+
+  static const true_false_string dsss_ofdm_flags = {
+    "DSSS-OFDM modulation allowed",
+    "DSSS-OFDM modulation not allowed"
+  };
 
+
   static const true_false_string cf_ibss_flags = {
     "Transmitter belongs to an IBSS",
     "Transmitter belongs to a BSS"
@@ -2249,6 +2293,16 @@
     {&ff_cf_agility,
      {"Channel Agility", "wlan_mgt.fixed.capabilities.agility",
       FT_BOOLEAN, 8, TFS (&cf_agility_flags), 0x0080, "Channel Agility", HFILL }},
+
+    {&ff_short_slot_time,
+     {"Short Slot Time", "wlan_mgt.fixed.capabilities.short_slot_time",
+      FT_BOOLEAN, 8, TFS (&short_slot_time_flags), 0x0400, "Short Slot Time",
+      HFILL }},
+
+    {&ff_dsss_ofdm,
+     {"DSSS-OFDM", "wlan_mgt.fixed.capabilities.dsss_ofdm",
+      FT_BOOLEAN, 8, TFS (&dsss_ofdm_flags), 0x2000, "DSSS-OFDM Modulation",
+      HFILL }},
 
     {&ff_auth_seq,
      {"Authentication SEQ", "wlan_mgt.fixed.auth_seq",