In lib/packet/lldp.py, the info field in OrganizationallySpecificTLV was never set. LLDP packets with OrganizationallySpecificTLV contained no info value and caused malformed LLDP packets. This patch fixes that problem, packets with OrganizationallySpecificTLV are valid now (tested with wireshark).

Please note: This fix was developed as part of my work at Google Inc. (jon...@google.com). It was approved by Google to be open sourced.


From 842240748ebba2e394fb095990b1220e45f5c3ab Mon Sep 17 00:00:00 2001
From: Jonas Grunert <jon...@google.com>
Date: Thu, 23 Jun 2016 15:54:11 -0700
Subject: [PATCH] Fix: LLDP.OrganizationallySpecific not ignoring info field

LLDP.OrganizationallySpecificTLV did not set info field and produced
malformed LLDP packets

---
 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 d0cae2f..9542519 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)
--
2.8.0.rc3.226.g39d4020

------------------------------------------------------------------------------
What NetFlow Analyzer can do for you? Monitors network bandwidth and traffic
patterns at an interface-level. Reveals which users, apps, and protocols are 
consuming the most bandwidth. Provides multi-vendor support for NetFlow, 
J-Flow, sFlow and other flows. Make informed decisions using capacity planning
reports.http://sdm.link/zohodev2dev
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to