There may be padding at the end of payload.
So the assumption that there is no payload after LLDP_TLV_END
is not correct.

Reported-by: Q Lady <[email protected]>
Signed-off-by: Isaku Yamahata <[email protected]>
---
 ryu/lib/packet/lldp.py |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/ryu/lib/packet/lldp.py b/ryu/lib/packet/lldp.py
index f343359..c0f16a4 100644
--- a/ryu/lib/packet/lldp.py
+++ b/ryu/lib/packet/lldp.py
@@ -137,9 +137,10 @@ class lldp(packet_base.PacketBase):
             tlv = cls._tlv_parsers[tlv_type](buf)
             tlvs.append(tlv)
             offset = LLDP_TLV_SIZE + tlv.len
+            if tlv.tlv_type == LLDP_TLV_END:
+                break
             buf = buf[offset:]
-            assert (len(buf) > 0 and tlv.tlv_type != LLDP_TLV_END) or \
-                   (len(buf) == 0 and tlv.tlv_type == LLDP_TLV_END)
+            assert len(buf) > 0
 
         lldp_pkt = cls(tlvs)
 
-- 
1.7.10.4


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to