On Sun, 5 Jan 2003, Tim Woodall wrote:
> On Sat, 4 Jan 2003, Tim Woodall wrote:
>
> > > > Dec 24 15:26:04 pcronald pppoa2[249]: CRC error in an AAL5 frame
> > >
> >
> > I think there is a problem somewhere but I'm not sure where.
> >
> <snip>
>
> The CRC errors are "caused" by the line
>
> swbuff(fdusb,1);
>
> in modem_run.c. Commenting this line out fixes my CRC errors.
> Can others give this a try?
>
> I don't believe this is really the problem, maybe there is a
> bug in pppoa3 (I suspect aal5_frame_dec where two frames are
> getting concatenated on slow computers - I'm about to have a play)
>
Seems like a good guess :-)
The following patch appears to have fixed my CRC errors.
I'll let it run for a bit to be sure but I was getting them
very regularly and now they seem better.
However, I am suddenly getting terrible packet loss on pings
but aparently not with TCP (I haven't checked UDP)
Regards,
Tim.
N.B. This patch is a HACK. It is NOT an example of good coding :-)
Index: atm.c
===================================================================
RCS file: /cvsroot/speedtouch/speedtouch/src/atm.c,v
retrieving revision 1.8
diff -u -r1.8 atm.c
--- atm.c 28 Dec 2002 13:42:21 -0000 1.8
+++ atm.c 5 Jan 2003 18:03:34 -0000
@@ -384,31 +384,48 @@
int aal5_frame_dec(unsigned char *data, unsigned char *frame, int length)
{
+ /* This is a mess and needs to be done properly
+ * The recursion is a HACK
+ */
- int real_length;
+ int real_length; /* The real length of the data in the frame */
+ int padded_length; /* The number of bytes it occupies */
unsigned int frame_crc, computed_crc;
-
+ int current_length = 0; /* The total number of bytes we have output */
+
+ /* Find the real len and crc from the frame*/
+ real_length = (frame[length - 6]<<8)+frame[length - 5];
+ frame_crc =
+(frame[length-4]<<24)+(frame[length-3]<<16)+(frame[length-2]<<8)+frame[length-1];
+
+ /* Find the padded len */
+ padded_length = ATM_CELL_DATA_SIZE * ((real_length + 8 + ATM_CELL_DATA_SIZE -
+1) / ATM_CELL_DATA_SIZE);
+
+ length -= padded_length;
+
+ if(length<0) { /* Not enough data? */
+ return -1;
+ }
+ else if(length>0) { /* another frame before this one in the buffer */
+ int prev_length = aal5_frame_dec(data, frame, length-padded_length);
+ if(prev_length == -1) /* What to do about errors? */
+ return -1;
+ data += prev_length;
+ current_length = prev_length;
+ }
+
/* CRC checking */
- computed_crc = ~aal5_calc_crc(frame, length - 4, ~0);
- frame_crc =
data[length-4]<<24|data[length-3]<<16|data[length-2]<<8|data[length-1];
+ computed_crc = ~aal5_calc_crc(frame+length, padded_length - 4, ~0);
/* If not equal the aal5 frame is corrupted */
if(computed_crc != frame_crc)
- return(-1);
-
- /* Find the real len */
- real_length = (((int)frame[length - 6])<<8)|((int)frame[length - 5]);
-
- /* If real > expected length, This is most likely a deliberate crack attempt */
- if(real_length > length)
- return(-1);
-
+ return(-1); /* Is this the right thing to do? */
+
/* Copy the data */
if(data != frame)
memmove(data, frame, real_length);
- return(real_length);
+ return(current_length + real_length);
}
> Regards,
>
> Tim.
>
>
--
God said, "div D = rho, div B = 0, curl E = - @B/@t, curl H = J + @D/@t,"
and there was light.
http://tjw.hn.org/ http://www.locofungus.btinternet.co.uk/
Liste de diffusion modem ALCATEL SpeedTouch USB
Pour se d�sinscrire : mailto:[EMAIL PROTECTED]?subject=unsubscribe