Subject: RE: data packet length in l2tp

From: "Verma, Rohit (US - Chicago)" <[email-masked]>
Date: Thu, 8 Jun 2000 17:01:39 -0700

Rajesh,
In most cases you should not completely rely on the length specified in the
packet when allocating memory or parsing the packet. Doing that with a
corrupted packet can land you into trouble. 
The best way is to rely on the underlying layers to give you the length and
decrement the length as you process the packet. It is usually a good idea to
check the length specified in the packet header with that specified to you
by the underlying layer a mismatch shows a clear problem. 
 
Since you need to process the AVPs any way, finding out the length will be
part of it so I don't think it makes you any slower.
I hope I have addressed your concerns.

Regards

Rohit Verma
Deloitte Consulting
180, N. Stetson Avenue
Chicago, Illinois 60601
Phone: 312-374-2475

-----Original Message-----
From: S.Rajesh Kumar [mailto:[email-masked]]
Sent: Thursday, June 08, 2000 4:31 PM
To: [email-masked]
Subject: data packet length in l2tp

L2tp data packets may or may not have a length field.
In the absence of a length field, how does an implementation
working over say BSD 4.3 udp sockets, find the length of a
data packet? And then read in a complete packet?

An approach of reading in avp by avp (since length of each avp
element is specified) sounds pretty slow....

Thanks
Rajesh