If an LLDP packet comes in and contains a vlan tag, lldp_input_handler()
did not handle this case.

Attached is a patch that adds this behavior.

Thanks,

Aaron


-- 
Aaron O. Rosen
Masters Student - Network Communication
306B Fluor Daniel
From 389163043d478a4131d129c9ce7b36eedf61411d Mon Sep 17 00:00:00 2001
From: Aaron Rosen <aro...@clemson.edu>
Date: Thu, 10 Nov 2011 21:09:00 -0500
Subject: [PATCH] lldp_input_handler() did not handle the case where an LLDP packet
 may have a vlan tag on it. This patch adds this check.

---
 src/nox/netapps/discovery/discovery.py |   16 ++++++++++------
 1 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/nox/netapps/discovery/discovery.py b/src/nox/netapps/discovery/discovery.py
index a68e839..0575c79 100644
--- a/src/nox/netapps/discovery/discovery.py
+++ b/src/nox/netapps/discovery/discovery.py
@@ -247,15 +247,19 @@ class discovery(Component):
 
     def lldp_input_handler(self, dp_id, inport, ofp_reason, total_frame_len, buffer_id, packet):
         
-        assert (packet.type == ethernet.LLDP_TYPE)
-    
         if not packet.next:
             lg.error("lldp_input_handler lldp packet could not be parsed")
             return
-    
-        assert (isinstance(packet.next, lldp))
-    
-        lldph = packet.next
+
+        if packet.type == ethernet.VLAN_TYPE:
+            assert(packet.next.eth_type == ethernet.LLDP_TYPE)
+            assert (isinstance(packet.next.next, lldp))
+            lldph = packet.next.next
+        else:
+            assert (packet.type == ethernet.LLDP_TYPE)
+            assert (isinstance(packet.next, lldp))
+            lldph = packet.next
+
         if  (len(lldph.tlvs) < 4) or \
             (lldph.tlvs[0].type != lldp.CHASSIS_ID_TLV) or\
             (lldph.tlvs[1].type != lldp.PORT_ID_TLV) or\
-- 
1.7.3.4

_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to