From 99d641c7d406833b76530910362db686c2e461da Mon Sep 17 00:00:00 2001 From: Jonas Grunert Date: Thu, 14 Jul 2016 17:34:15 +0900 Subject: [PATCH] Fix: LLDP.OrganizationallySpecific not ignoring info field LLDP.OrganizationallySpecificTLV did not set info field and produced malformed LLDP packets Signed-off-by: FUJITA Tomonori --- ryu/lib/packet/lldp.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/ryu/lib/packet/lldp.py b/ryu/lib/packet/lldp.py index d0cae2fa..95425196 100644 --- a/ryu/lib/packet/lldp.py +++ b/ryu/lib/packet/lldp.py @@ -479,6 +479,7 @@ class OrganizationallySpecific(LLDPBasicTLV): if buf: (self.oui, self.subtype) = struct.unpack( self._PACK_STR, self.tlv_info[:self._PACK_SIZE]) + self.info = self.tlv_info[self._PACK_SIZE:] else: self.oui = kwargs['oui'] self.subtype = kwargs['subtype'] @@ -488,7 +489,8 @@ class OrganizationallySpecific(LLDPBasicTLV): self.typelen = (self.tlv_type << LLDP_TLV_TYPE_SHIFT) | self.len def serialize(self): - return struct.pack('!H3sB', self.typelen, self.oui, self.subtype) + return struct.pack('!H3sB', self.typelen, self.oui, + self.subtype) + self.info lldp.set_classes(lldp._tlv_parsers)