Ethereal-dev: Re: [ethereal-dev] LAPB/X.25 patch

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

From: Olivier Abad <abad@xxxxxxxxxxxxx>
Date: Tue, 3 Aug 1999 23:06:32 +0200
On mar, aoû 03, 1999 at 12:05:34 +0200, Olivier Abad wrote:
> Here is a small patch against your modified tree. It seems to work
> well for me, but my captures only contain Receive Ready and
> Information frames (I included shifting in decode_numeric_bitfield ;
> you may want to remove it...).

The patch was reversed. Here is a correct one :

diff -Naur ethereal.xdlc/packet-lapb.c ethereal.xdlc2/packet-lapb.c
--- ethereal.xdlc/packet-lapb.c	Tue Aug  3 20:58:11 1999
+++ ethereal.xdlc2/packet-lapb.c	Tue Aug  3 21:00:05 1999
@@ -82,7 +82,7 @@
     else
         lapb_tree = NULL;
     dissect_xdlc_control(pd, 1, fd, lapb_tree, hf_lapb_control,
-	    FALSE, is_response);
+	    is_response, FALSE);
 
     /* not end of frame ==> X.25 */
     if (fd->cap_len > 2) dissect_x25(pd, 2, fd, tree);
diff -Naur ethereal.xdlc/packet.c ethereal.xdlc2/packet.c
--- ethereal.xdlc/packet.c	Tue Aug  3 20:57:38 1999
+++ ethereal.xdlc2/packet.c	Tue Aug  3 21:01:18 1999
@@ -530,9 +530,12 @@
 {
   static char buf[1025];
   char *p;
+  int shift=0;
+
+  while ((mask & (1<<shift)) == 0) shift++;
 
   p = decode_bitfield_value(buf, val, mask, width);
-  sprintf(p, fmt, val & mask);
+  sprintf(p, fmt, (val & mask) >> shift);
   return buf;
 }
 
diff -Naur ethereal.xdlc/xdlc.c ethereal.xdlc2/xdlc.c
--- ethereal.xdlc/xdlc.c	Tue Aug  3 20:58:11 1999
+++ ethereal.xdlc2/xdlc.c	Tue Aug  3 21:02:23 1999
@@ -183,15 +183,15 @@
 	    break;
 	}
 	if (is_extended) {
-	    sprintf(info, "S%s, func = %s, N(R) = %u", frame_type,
+	    sprintf(info, "S%s, %sN(R) = %u", frame_type,
 		 	((control & XDLC_P_F_EXT) ?
-		 	    (is_response ? " F" : " P") :
+		 	    (is_response ? "func = F, " : "func = P, ") :
 		 	    ""),
 			(control & XDLC_N_R_EXT_MASK) >> XDLC_N_R_EXT_SHIFT);
 	} else {
-	    sprintf(info, "S%s, func = %s, N(R) = %u", frame_type,
+	    sprintf(info, "S%s, %sN(R) = %u", frame_type,
 		 	((control & XDLC_P_F) ?
-		 	    (is_response ? " F" : " P") :
+		 	    (is_response ? "func = F, " : "func = P, ") :
 		 	    ""),
 			(control & XDLC_N_R_MASK) >> XDLC_N_R_SHIFT);
 	}



-- 
He who laughs last -- missed the punch line.