Ethereal-dev: [Ethereal-dev] Problem with info column change

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

From: Joerg Mayer <jmayer@xxxxxxxxx>
Date: Sun, 19 Dec 2004 08:10:07 +0100
Hello,

I'm trying to add the SSID to the COL_INFO field but for some reason
it is never appended. It looks like the check always returns false,
but this doesen't make sense.

Hints anyone?

 Ciao
     Joerg
-- 
Joerg Mayer                                           <jmayer@xxxxxxxxx>
We are stuck with technology when what we really want is just stuff that
works. Some say that should read Microsoft instead of technology.
Index: packet-ieee80211.c
===================================================================
--- packet-ieee80211.c	(revision 12772)
+++ packet-ieee80211.c	(working copy)
@@ -1176,7 +1176,7 @@
 };
 
 static int
-add_tagged_field (proto_tree * tree, tvbuff_t * tvb, int offset)
+add_tagged_field (packet_info * pinfo, proto_tree * tree, tvbuff_t * tvb, int offset)
 {
   const guint8 *tag_data_ptr;
   guint32 tag_no, tag_len;
@@ -1211,6 +1211,14 @@
 
       proto_tree_add_string (tree, tag_interpretation, tvb, offset + 2,
 			     tag_len, out_buff);
+      if (check_col (pinfo->cinfo, COL_INFO)) {
+	  if (tag_len > 0) {
+	      /* FIXME: the SSID is of type OCTET, not ASCII */
+              col_append_fstr(pinfo->cinfo, COL_INFO, ", SSID: \"%s\"", out_buff);
+	  } else {
+              col_append_fstr(pinfo->cinfo, COL_INFO, ", SSID: Broadcast");
+	  }
+      }
       break;
 
 
@@ -1384,13 +1392,13 @@
 }
 
 void
-ieee_80211_add_tagged_parameters (tvbuff_t * tvb, int offset, proto_tree * tree,
-       int tagged_parameters_len)
+ieee_80211_add_tagged_parameters (tvbuff_t * tvb, int offset, packet_info * pinfo,
+	proto_tree * tree, int tagged_parameters_len)
 {
   int next_len;
 
   while (tagged_parameters_len > 0) {
-    if ((next_len=add_tagged_field (tree, tvb, offset))==0)
+    if ((next_len=add_tagged_field (pinfo, tree, tvb, offset))==0)
       break;
     if (next_len > tagged_parameters_len) {
       /* XXX - flag this as an error? */
@@ -1436,7 +1444,7 @@
 	  tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
 						   tagged_parameter_tree_len);
 
-	  ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+	  ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 	      tagged_parameter_tree_len);
 	  break;
 
@@ -1454,7 +1462,7 @@
 	  tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
 						   tagged_parameter_tree_len);
 
-	  ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+	  ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 	      tagged_parameter_tree_len);
 	  break;
 
@@ -1471,7 +1479,7 @@
 	  tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
 						   tagged_parameter_tree_len);
 
-	  ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+	  ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 	      tagged_parameter_tree_len);
 	  break;
 
@@ -1487,7 +1495,7 @@
 	  tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
 						   tagged_parameter_tree_len);
 
-	  ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+	  ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 	      tagged_parameter_tree_len);
 	  break;
 
@@ -1499,7 +1507,7 @@
 	  tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
 						   tagged_parameter_tree_len);
 
-	  ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+	  ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 	      tagged_parameter_tree_len);
 	  break;
 
@@ -1516,7 +1524,7 @@
 	  tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
 						   tagged_parameter_tree_len);
 
-	  ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+	  ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 	      tagged_parameter_tree_len);
 	  break;
 
@@ -1534,7 +1542,7 @@
 	  tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
 						   tagged_parameter_tree_len);
 
-	  ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+	  ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 	      tagged_parameter_tree_len);
 	  break;
 
@@ -1566,7 +1574,7 @@
 						       offset,
 						       tagged_parameter_tree_len);
 
-	      ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+	      ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 		tagged_parameter_tree_len);
 	    }
 	  break;
@@ -1599,7 +1607,7 @@
 		  tagged_tree = get_tagged_parameter_tree (mgt_tree, tvb, offset,
 							   tagged_parameter_tree_len);
 
-		  ieee_80211_add_tagged_parameters (tvb, offset, tagged_tree,
+		  ieee_80211_add_tagged_parameters (tvb, offset, pinfo, tagged_tree,
 						    tagged_parameter_tree_len);
 		}
 	      break;
Index: packet-ieee80211.h
===================================================================
--- packet-ieee80211.h	(revision 12768)
+++ packet-ieee80211.h	(working copy)
@@ -31,4 +31,4 @@
 void capture_ieee80211_fixed (const guchar *, int, int, packet_counts *);
 
 void ieee_80211_add_tagged_parameters (tvbuff_t * tvb, int offset,
-       proto_tree * tree, int tagged_parameters_len);
+       packet_info * pinfo, proto_tree * tree, int tagged_parameters_len);
Index: packet-eapol.c
===================================================================
--- packet-eapol.c	(revision 12768)
+++ packet-eapol.c	(working copy)
@@ -237,7 +237,7 @@
 	     * Cannot parse this without knowing the key. */
 	  } else {
 	    keydes_tree = proto_item_add_subtree(ti, ett_eapol_keydes_data);
-	    ieee_80211_add_tagged_parameters(tvb, offset, keydes_tree,
+	    ieee_80211_add_tagged_parameters(tvb, offset, pinfo, keydes_tree,
 					     eapol_data_len);
 	  }
         }