This corrects what appear to be two errors in the arguments
passed to OFPMatch.parser() by OFPPacketIn.parser().

* The buffer is msg.buf, buf doesn't exist in this context
* ofproto_v1_2.OFP_PACKET_IN_SIZE includes ofproto_v1_2.OFP_HEADER_SIZE
  so it should not be added to the offset passed to OFPMatch.parser().

Signed-off-by: Simon Horman <[email protected]>
---
 ryu/ofproto/ofproto_v1_2_parser.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_2_parser.py 
b/ryu/ofproto/ofproto_v1_2_parser.py
index b5c3198..1649e0a 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -233,8 +233,8 @@ class OFPPacketIn(MsgBase):
             ofproto_v1_2.OFP_PACKET_IN_PACK_STR,
             msg.buf, ofproto_v1_2.OFP_HEADER_SIZE)
 
-        offset = ofproto_v1_2.OFP_HEADER_SIZE + ofproto_v1_2.OFP_PACKET_IN_SIZE
-        msg.match = OFPMatch.parser(buf, offset - ofproto_v1_2.OFP_MATCH_SIZE)
+        msg.match = OFPMatch.parser(msg.buf, ofproto_v1_2.OFP_PACKET_IN_SIZE -
+                                    ofproto_v1_2.OFP_MATCH_SIZE)
         return msg
 
 
-- 
1.7.10.2.484.gcd07cc5


------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to