Subject: mpls_encdec.c code by Nortel

From: 김현석 <[email-masked]>
Date: Fri, 23 Jun 100 21:24:37 +0900 (KST)

I think it is a good idea to ask many people in the world
about some problem.
I saw the encoding and decoding routine in mpls_encdec.c coded by Nortel
In the way of testing the Nortel code, 
I found something strange in the code.
Label Request encoding routine has below code.

--------------------------------------------
	MEM_COPY( tempBuf,
		   (u_char*)&(fecAdrEl->addressEl.address),
		  fecAdrEl->addressEl.preLen);
--------------------------------------------
"fecAdrEl->addressEl.preLen" is a variable that is filled 
with the prefix length in bits.
Is it a correct code?
I need a advice.

In addition, I ask you about some code related "Label Request".

--------------------------------------------
	preLen = fecAdrEl->addressEl.preLen;
	if (fecAdrEl->addressEl.preLen > sizeof(u_int))
	{
	  /* error - the length cannot exeed 32 bits */
		/* skip the FEC and return error code */
		/* fill in the preLen field to the number of bytes for this
	   	   fec; we need it to know how much to skip from the buffer
		   when we do the decoding for the following fec element 
		*/
		   fecAdrEl->addressEl.preLen = preLen + decodedSize;
		   return MPLS_FECERROR;
																					 }
--------------------------------------------

Draft says that preLen contains a length of prefix in bits.
Except the case of zero length of prefix, 
this condition could be satisfied?

Hope your good answer.

----------- from Korea.