Ethereal-dev: [Ethereal-dev] PATCH X25

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

From: MEYER Laurent <laurent.meyer@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 26 Feb 2003 18:23:02 +0100
    Hi,

    I'm working with X25 protocol and is some cases, other protocols may
be found in
the payload of X25 CALL REQUEST / CONFIRM PDUs

    So i added this case in packet-x25.c ie :

-> a protocol preference entry which asks if we want to decode
      CALL REQUEST / CONFIRM PDUs payloads

->The lines of code which do this :)

    The corresponding patch follow in attachement.

    Thanx

    Laurent MEYER.
--- packet-x25.c.orig	Wed Feb 26 10:39:49 2003
+++ packet-x25.c	Wed Feb 26 18:06:24 2003
@@ -182,6 +182,7 @@
 
 /* Preferences */
 static gboolean payload_is_qllc_sna = FALSE;
+static gboolean decode_cr_ca_payloads = FALSE;
 
 static dissector_table_t x25_subdissector_table;
 static heur_dissector_list_t x25_heur_subdissector_list;
@@ -1415,7 +1416,7 @@
     guint x25_pkt_len;
     int modulo;
     guint16 vc;
-    dissector_handle_t dissect;
+    dissector_handle_t dissect = NULL;
     gboolean toa;         /* TOA/NPI address format */
     guint16 bytes0_1;
     guint8 pkt_type;
@@ -1715,7 +1716,6 @@
 					"X.263 secondary protocol ID: %s",
 					val_to_str(spi, nlpid_vals, "Unknown (0x%02x)"));
 		}
-		localoffset++;
 
 		if (!pinfo->fd->flags.visited) {
 		    /*
@@ -1726,6 +1726,10 @@
 		    if (dissect != NULL)
 			x25_hash_add_proto_start(vc, pinfo->fd->num, dissect);
 		}
+		if (decode_cr_ca_payloads == TRUE)
+		  break;
+		localoffset++;
+
 	    }
 	    if (localoffset < tvb_length(tvb)) {
 		if (userdata_tree) {
@@ -1771,7 +1775,8 @@
 
 	if (localoffset < x25_pkt_len) /* facilities */
 	    dump_facilities(x25_tree, &localoffset, tvb);
-
+	if (decode_cr_ca_payloads == TRUE)
+	  break;
 	if (localoffset < tvb_reported_length(tvb)) { /* user data */
 	    if (x25_tree)
 	        proto_tree_add_text(x25_tree, tvb, localoffset,
@@ -2313,6 +2318,11 @@
             "Default to QLLC/SNA",
             "If CALL REQUEST not seen or didn't specify protocol, dissect as QLLC/SNA",
             &payload_is_qllc_sna);
+    prefs_register_bool_preference(x25_module, "decode_cr_ca_payloads",
+				   "Decode CR and CC payloads when present",
+				   "Some stacks may put upper layer datas eg: SNDCF connect in the user data field of X25 CALL REQUEST/ACCEPT, dissect it",
+				   &decode_cr_ca_payloads);
+
 }
 
 void