Wireshark-dev: [Wireshark-dev] frame relay bugfix
From: Rene Pilz <[email protected]>
Date: Fri, 24 Nov 2006 15:53:34 +0100
Hi

Attached is a patch for following items:
- Frame Relay: Calculate the size of the frame relay header larger than
2 bytes correctly
- ERF File: In approx 10% of the cases ethereal is not able to recognize
the ERF file correctly. So the file format check of erf is moved more to
the beginning of the function. This is not real a solution, but as erf
files are not that seldom this might be acceptable.
- Added Columns: Add columns for DLCI (Frame Relay) and TLLI (GSM
BSSGP). As these are crucial Identifiers within this protocol this is
rather useful. At least they asked me several times.

So please take a look at it. Thanks.

Best Regards
Rene

-- 
Dipl-Ing (FH) MSc. C.E René Pilz
ftw. Telekommunications Research Center Vienna http://www.ftw.at
Tech Gate Vienna, Donaucitystraße 1, A-1220 Wien
Mobile: +43 664 8269871 Office: +43 1 5052830-13  Fax: +43 1 5052830-99

Index: epan/column.c
===================================================================
--- epan/column.c	(revision 19967)
+++ epan/column.c	(working copy)
@@ -93,7 +93,9 @@
     "%y", 
     "%z", 
     "%v", 
-    "%E"
+    "%E",
+	"%C",
+	"%l"
 };
                      
   if (fmt < 0 || fmt >= NUM_COL_FMTS)
@@ -154,6 +156,8 @@
 	"DCE/RPC context ID (cn_ctx_id)",           /* COL_DCE_CTX */
 	"802.1Q VLAN id",                           /* COL_8021Q_VLAN_ID */
 	"TEI",                                      /* XXX - why is it missing in column_utils.c and elsewhere? */
+	"Frame Relay DLCI",							/* COL_FR_DLCI */
+	"GPRS BSSGP TLLI",							/* COL_BSSGP_TLLI */
 };
 
 const gchar *
@@ -260,6 +264,12 @@
     case COL_TEI:
       fmt_list[COL_TEI] = TRUE;
       break;
+    case COL_FR_DLCI:
+      fmt_list[COL_FR_DLCI] = TRUE;
+      break;
+    case COL_BSSGP_TLLI:
+      fmt_list[COL_BSSGP_TLLI] = TRUE;
+      break;
     default:
       break;
   }
@@ -460,7 +470,7 @@
       return "0000000";
       break;
     case COL_VSAN:
-      return "000000";
+     return "000000";
       break;
     case COL_TX_RATE:
       return "108.0";
@@ -486,6 +496,12 @@
     case COL_TEI:
       return "127";
       break;
+    case COL_FR_DLCI:
+      return "8388608";
+      break;
+    case COL_BSSGP_TLLI:
+      return "0xffffffff";
+      break;
     default: /* COL_INFO */
       return "Source port: kerberos-master  Destination port: kerberos-master";
       break;
@@ -640,6 +656,10 @@
 	break;
       case 'E':
 	return COL_TEI;
+      case 'C':
+	return COL_FR_DLCI;
+      case 'l':
+	return COL_BSSGP_TLLI;
 	break;
     }
     cptr++;
Index: epan/column-utils.c
===================================================================
--- epan/column-utils.c	(revision 19967)
+++ epan/column-utils.c	(working copy)
@@ -1242,6 +1242,10 @@
     case COL_8021Q_VLAN_ID:
         break;
 
+    case COL_FR_DLCI:	/* done by packet-fr.c */
+    case COL_BSSGP_TLLI: /* done by packet-bssgp.c */
+        break;
+
     case NUM_COL_FMTS:	/* keep compiler happy - shouldn't get here */
       g_assert_not_reached();
       break;
Index: epan/dissectors/packet-fr.c
===================================================================
--- epan/dissectors/packet-fr.c	(revision 19967)
+++ epan/dissectors/packet-fr.c	(working copy)
@@ -551,6 +551,8 @@
       }
       proto_tree_add_boolean(octet_tree, hf_fr_dc, tvb, offset, 1, fr_octet);
       proto_tree_add_boolean(octet_tree, hf_fr_ea, tvb, offset, 1, fr_octet);
+      
+      offset++;
     }
   }
   if (tree) {
@@ -561,6 +563,11 @@
   pinfo->ctype = CT_DLCI;
   pinfo->circuit_id = address;
 
+  /* Add DLCI to a collumn */
+  if ( check_col(pinfo->cinfo, COL_FR_DLCI)) {
+      col_add_fstr(pinfo->cinfo, COL_FR_DLCI, "%u", address);
+  }
+  
   if (check_col(pinfo->cinfo, COL_INFO))
       col_add_fstr(pinfo->cinfo, COL_INFO, "DLCI %u", address);
 
Index: epan/dissectors/packet-bssgp.c
===================================================================
--- epan/dissectors/packet-bssgp.c	(revision 19967)
+++ epan/dissectors/packet-bssgp.c	(working copy)
@@ -2892,6 +2892,11 @@
     col_append_sep_fstr(bi->pinfo->cinfo, COL_INFO, BSSGP_SEP, 
 			"TLLI %#4x", tlli);
   }
+  
+  if (check_col(bi->pinfo->cinfo, COL_BSSGP_TLLI)) {
+    col_add_fstr(bi->pinfo->cinfo, COL_BSSGP_TLLI, "%#04x", tlli);
+  }
+  
   decode_nri(bi->bssgp_tree, bi, tlli);
 }
 
Index: epan/column_info.h
===================================================================
--- epan/column_info.h	(revision 19967)
+++ epan/column_info.h	(working copy)
@@ -101,6 +101,8 @@
   COL_DCE_CTX,        /* DCE/RPC connection oriented context id */
   COL_8021Q_VLAN_ID,  /* 802.1Q vlan ID */
   COL_TEI,            /* q.921 TEI */
+  COL_FR_DLCI,		  /* Frame Relay DLCI */
+  COL_BSSGP_TLLI,	  /* GPRS BSSGP IE TLLI */
   NUM_COL_FMTS        /* Should always be last */
 };
 
Index: wiretap/file_access.c
===================================================================
--- wiretap/file_access.c	(revision 19967)
+++ wiretap/file_access.c	(working copy)
@@ -117,6 +117,7 @@
 	 * would be, for example, saved copies of a Telnet session
 	 * to some box.
 	 */
+	erf_open,
 	etherpeek_open,
 	pppdump_open,
 	iseries_open,
@@ -127,7 +128,6 @@
 	csids_open,
 	vms_open,
 	cosine_open,
-	erf_open,
 	hcidump_open,
 };