Fix end of TLV in LLDP packet 42/5042/1
authorDiti Bhatia <dibhatia@cisco.com>
Thu, 30 Jan 2014 20:46:22 +0000 (12:46 -0800)
committerDiti Bhatia <dibhatia@cisco.com>
Thu, 30 Jan 2014 20:53:06 +0000 (12:53 -0800)
Change-Id: Id4bc88bcf792758ff73f9d143481aca2a6ef3c95
Signed-off-by: Diti Bhatia <dibhatia@cisco.com>
opendaylight/sal/api/src/main/java/org/opendaylight/controller/sal/packet/LLDP.java

index 95edca9..6f5cf04 100644 (file)
@@ -198,6 +198,9 @@ public class LLDP extends Packet {
         while (lldpSize > 0) {
             LLDPTLV tlv = new LLDPTLV();
             tlv.deserialize(data, lldpOffset, lldpSize);
+            if (tlv.getType() == 0 && tlv.getLength() == 0) {
+               break;
+            }
             int tlvSize = tlv.getTLVSize(); // Size of current TLV in bits
             lldpOffset += tlvSize;
             lldpSize -= tlvSize;