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 95edca943bc8a61681c34c582f4aeb9dddb7972e..6f5cf04a529ed5a2872ff1d7c299eac71a1e060a 100644 (file)
@@ -198,6 +198,9 @@ public class LLDP extends Packet {
         while (lldpSize > 0) {
             LLDPTLV tlv = new LLDPTLV();
             tlv.deserialize(data, lldpOffset, lldpSize);
         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;
             int tlvSize = tlv.getTLVSize(); // Size of current TLV in bits
             lldpOffset += tlvSize;
             lldpSize -= tlvSize;