mirror of
https://github.com/faucetsdn/ryu.git
synced 2026-05-08 22:06:10 +02:00
packet lib: stop tlv parsing when finding LLDP_TLV_END
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 <holynn.q@gmail.com> Signed-off-by: Isaku Yamahata <yamahata@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
694c8330a5
commit
23e6b8fcb8
@ -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)
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user