Merge "Fix end of TLV in LLDP packet"
authorAlessandro Boch <aboch@cisco.com>
Tue, 4 Feb 2014 02:56:44 +0000 (02:56 +0000)
committerGerrit Code Review <gerrit@opendaylight.org>
Tue, 4 Feb 2014 02:56:44 +0000 (02:56 +0000)
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);
+            if (tlv.getType() == 0 && tlv.getLength() == 0) {
+               break;
+            }
             int tlvSize = tlv.getTLVSize(); // Size of current TLV in bits
             lldpOffset += tlvSize;
             lldpSize -= tlvSize;