Re: [nox-dev] Discovery Assertion Error Patch

2009-07-09 Thread Martin Casado

Awesome, thanks for the patch Dave.

Hi all,
I ran into a bug in discovery when it receives an LLDP packet with a 
vlan tag, the matcher takes into account the fact that it has the VLAN 
tag but the actual discovery code does not and throws an assertion 
error. This was happening in the .4 branch we have, but I checked and 
the code has not changed other than a delay value for .5, so it still 
seems vulnerable to the same problem. There also is a second assertion 
check after calling packet.next to verify the object is actually LLDP, 
negating the need for the first assertion.


diff --git a/src/nox/netapps/discovery/discovery.py 
b/src/nox/netapps/discovery/discovery.py

index 3ad0a7c..0a2de37 100644
--- a/src/nox/netapps/discovery/discovery.py
+++ b/src/nox/netapps/discovery/discovery.py
@@ -227,8 +227,9 @@ 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 (packet.type == ethernet.VLAN_TYPE):
+packet = packet.next
+
 if not packet.next:
 lg.error("lldp_input_handler lldp packet could not be 
parsed")

 return


Thanks,
David

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



--
Martin Casado
CTO, Nicira Networks
650-776-1457 (m)




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


[nox-dev] Discovery Assertion Error Patch

2009-07-09 Thread David Erickson

Hi all,
I ran into a bug in discovery when it receives an LLDP packet with a 
vlan tag, the matcher takes into account the fact that it has the VLAN 
tag but the actual discovery code does not and throws an assertion 
error. This was happening in the .4 branch we have, but I checked and 
the code has not changed other than a delay value for .5, so it still 
seems vulnerable to the same problem. There also is a second assertion 
check after calling packet.next to verify the object is actually LLDP, 
negating the need for the first assertion.


diff --git a/src/nox/netapps/discovery/discovery.py 
b/src/nox/netapps/discovery/discovery.py

index 3ad0a7c..0a2de37 100644
--- a/src/nox/netapps/discovery/discovery.py
+++ b/src/nox/netapps/discovery/discovery.py
@@ -227,8 +227,9 @@ 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 (packet.type == ethernet.VLAN_TYPE):
+packet = packet.next
+
 if not packet.next:
 lg.error("lldp_input_handler lldp packet could not be parsed")
 return


Thanks,
David

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