when lldp packet has padding bytes, "00", it will trigger assertion
error, this is not we wanted, because som of-switch didn't allow packet
which is smaller than 64 bytes to be sent.

Signed-off-by: Linlin Hou <[email protected]>
---
 ryu/lib/packet/lldp.py |    4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ryu/lib/packet/lldp.py b/ryu/lib/packet/lldp.py
index f343359..0b5f7f7 100644
--- a/ryu/lib/packet/lldp.py
+++ b/ryu/lib/packet/lldp.py
@@ -138,6 +138,10 @@ class lldp(packet_base.PacketBase):
             tlvs.append(tlv)
             offset = LLDP_TLV_SIZE + tlv.len
             buf = buf[offset:]
+
+            # When the lldp packet has padding bytes, End the buf parse
+            if tlv.tlv_type == LLDP_TLV_END:
+                buf = []
             assert (len(buf) > 0 and tlv.tlv_type != LLDP_TLV_END) or \
                    (len(buf) == 0 and tlv.tlv_type == LLDP_TLV_END)

-- 
1.7.9.5


------------------------------------------------------------------------------
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