@@ -202,22 +202,26 @@ public static LLDPTrailer getTrailer(FVPacketIn pi) {
202202 try {
203203 FVLog .log (LogLevel .DEBUG , null , " packet capacity: " , packet .capacity ());
204204 int offset = packet .capacity () - END_LLDPDU_LEN ;
205-
206- if (packet .get (offset ) != 0 )
205+ //FVLog.log(LogLevel.DEBUG, null, "offset0: ",offset);
206+ if (packet .get (offset ) != 0 ){
207207 FVLog .log (LogLevel .WARN , null , "End of LLDPDU is missing" );
208-
208+ return null ;//didn't find the End Trailer, so does not contain the rest too!
209+ }
209210 offset -= FLOWNAMELEN_LEN ;
211+ //FVLog.log(LogLevel.DEBUG, null, "offset1: ",offset);
210212 byte flowLen = packet .get (offset );
213+ FVLog .log (LogLevel .DEBUG , null , "flowLen: " ,flowLen );
211214 offset -= SLICENAMELEN_LEN ;
215+ //FVLog.log(LogLevel.DEBUG, null, "offset2: ",offset);
212216 byte sliceLen = packet .get (offset );
217+ FVLog .log (LogLevel .DEBUG , null , "sliceLen: " ,sliceLen );
213218 offset = offset - (flowLen + sliceLen ); // this includes the NULL
219+ //FVLog.log(LogLevel.DEBUG, null, "offset3: ",offset);
214220 packet .position (offset );
215-
221+ FVLog . log ( LogLevel . MOBUG , null , "packet: " , packet . toString ());
216222 sliceName = StringByteSerializer .readFrom (packet , sliceLen );
217223 fvName = StringByteSerializer .readFrom (packet , flowLen );
218224
219- FVLog .log (LogLevel .DEBUG , null , "sliceName = " , sliceName , "fvName= " , fvName );
220-
221225 //Check for the OUI Id and its subtype from backwards -
222226 offset -= 1 ;
223227 FVLog .log (LogLevel .DEBUG , null , " OUI Subtype: " ,packet .get (offset ));
@@ -237,7 +241,12 @@ public static LLDPTrailer getTrailer(FVPacketIn pi) {
237241 FVLog .log (LogLevel .ALERT , null , "Wrong OUI2" );
238242 }
239243 catch (IndexOutOfBoundsException ioe ){
240- FVLog .log (LogLevel .CRIT , null , "Yikes! The LLDP packet-in is not well formed - IndexOutOfBound while getting the trailer " );
244+ FVLog .log (LogLevel .CRIT , null , "Yikes! The LLDP packet-in is not well formed - " +
245+ " IndexOutOfBound while getting the trailer " ,ioe );
246+ }
247+ catch (IllegalArgumentException iae ){
248+ FVLog .log (LogLevel .CRIT , null , "Yikes! Got an illegal argument-something wrong " +
249+ " with the positioning of the offset in the ByteBuffer! " ,iae );
241250 }
242251
243252 /*offset = offset - (OUI_HEADER_LEN + TTL_LEN + TTL_HEADER_LEN + PORT_LEN);
0 commit comments