Ethereal-dev: [Ethereal-dev] [Fwd: Patch]

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

From: Pilz Rene <rene.pilz@xxxxxx>
Date: Fri, 08 Oct 2004 19:51:08 +0200

--
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

--- Begin Message ---
From: Pilz Rene <rene.pilz@xxxxxx>
Date: Fri, 08 Oct 2004 01:04:52 +0200
Hi

Attached there are two patches, which migth be interessting for ethereal.

packet-gsm_a.patch:
This one connects packet-grps-llc.c and packet-gsm_a.c.

packet-grps-llc.patch:
Usually I get traces where the cipher bit is set, but the data is unciphered. Therefore it should be ignored. To do it for everyone right, I have added a option, which can be set.

If you have any comments, feel free to write a email to me.

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

--- /home/pilz/tmp/ethereal-0.10.6/epan/dissectors/packet-gprs-llc.c	2004-08-13 00:42:05.000000000 +0200
+++ packet-gprs-llc.c	2004-10-08 00:41:06.000000000 +0200
@@ -38,6 +38,7 @@
 #endif
 
 #include <epan/packet.h>
+#include "prefs.h"
 /*
 #include "packet-llcgprs.h"
 */
@@ -81,6 +82,12 @@
 static gint ett_llcgprs_sframe = -1;
 
 static dissector_handle_t data_handle;
+
+#define ANALYSE_CIPHER_BIT		0
+#define IGNORE_CIPHER_BIT		1
+
+static gint llc_cipher = ANALYSE_CIPHER_BIT;
+
 static dissector_table_t llcgprs_subdissector_table;
 static const value_string sapi_t[] = {
 	{  0, "Reserved"},
@@ -224,7 +231,7 @@
 			if (check_col(pinfo->cinfo,COL_INFO)){
 				col_append_str(pinfo->cinfo,COL_INFO, ", I");
 			}
-				
+			
 			break;
 		case S_FORMAT:
 		case UI_FORMAT:
@@ -263,12 +270,28 @@
 				proto_tree_add_boolean( ctrl_f_tree, hf_llcgprs_PM_bit, tvb, offset-2,2,ctrl_fld_ui_s);
 		     	  }
 
- 		   	  next_tvb = tvb_new_subset(tvb, offset,crc_start-3, -1 );
-		   	  if (epm < 2){
-		   	    if  (!dissector_try_port(llcgprs_subdissector_table,sapi, next_tvb, pinfo, tree))
-		   		call_dissector(data_handle, next_tvb, pinfo, tree);
-			  }
-		          else	call_dissector(data_handle, next_tvb, pinfo, tree);
+			if ( llc_cipher == ANALYSE_CIPHER_BIT )
+			{
+				/*
+				 * analyse chipher bit
+				 */
+				next_tvb = tvb_new_subset(tvb, offset,crc_start-3, -1 );
+				if (epm < 2){
+					if  (!dissector_try_port(llcgprs_subdissector_table,sapi, next_tvb, pinfo, tree))
+						call_dissector(data_handle, next_tvb, pinfo, tree);
+				}
+				else
+					call_dissector(data_handle, next_tvb, pinfo, tree);
+			}
+			else
+			{
+				/*
+				 * don't care about the cipher bit
+				 */
+ 		   		next_tvb = tvb_new_subset(tvb, offset,crc_start-3, -1 );
+				if  (!dissector_try_port(llcgprs_subdissector_table,sapi, next_tvb, pinfo, tree))
+		   			call_dissector(data_handle, next_tvb, pinfo, tree);
+			}
 			}
 			break;
 		case U_FORMAT:
@@ -359,6 +382,14 @@
 		&ett_llcgprs_sframe,
 	};
 
+	static enum_val_t gprs_llc_cipher_options[] = {
+		{ "analyse cipher bit" , "Analyse cipher bit" , ANALYSE_CIPHER_BIT },
+		{ "ignore cipher bit" , "Ignore cipher bit" , IGNORE_CIPHER_BIT },
+		{ NULL , NULL , 0 },
+	};
+	
+	module_t *llccipher_module;
+	
 /* Register the protocol name and description */
 	proto_llcgprs = proto_register_protocol("Logical Link Control GPRS",
 	    "GPRS-LLC", "llcgprs");
@@ -367,6 +398,11 @@
 	proto_register_field_array(proto_llcgprs, hf, array_length(hf));
 	proto_register_subtree_array(ett, array_length(ett));
 	register_dissector( "llcgprs", dissect_llcgprs, proto_llcgprs);
+	
+	llccipher_module = prefs_register_protocol ( proto_llcgprs , NULL );
+	prefs_register_enum_preference ( llccipher_module , "cipher" , "Cipher" , 
+					"Cipher" , &llc_cipher ,
+					gprs_llc_cipher_options , FALSE );
 }
 
 
@@ -385,4 +421,3 @@
 */
 	data_handle = find_dissector("data");
 }
-
--- /home/pilz/tmp/ethereal-0.10.6/epan/dissectors/packet-gsm_a.c	2004-08-13 00:42:00.000000000 +0200
+++ packet-gsm_a.c	2004-08-25 17:12:03.000000000 +0200
@@ -11372,6 +11372,6 @@
     dissector_add("bssap.pdu_type",  BSSAP_PDU_TYPE_BSSMAP, bssmap_handle);
     dissector_add("bssap.pdu_type",  BSSAP_PDU_TYPE_DTAP, dtap_handle);
     dissector_add("ranap.nas_pdu",  BSSAP_PDU_TYPE_DTAP, dtap_handle);
-
+    dissector_add("llcgprs.sapi", 1 , dtap_handle);
     data_handle = find_dissector("data");
 }

--- End Message ---