frame data can contain padding of ofp packet. Discard padding.
Otherwise packet parser can get confused which can rely on frame length.
This is a preparation for LLDP TLV parser.

Signed-off-by: Isaku Yamahata <[email protected]>
---
 ryu/ofproto/ofproto_v1_0_parser.py |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/ryu/ofproto/ofproto_v1_0_parser.py 
b/ryu/ofproto/ofproto_v1_0_parser.py
index 0bd91c3..c4e3bbb 100644
--- a/ryu/ofproto/ofproto_v1_0_parser.py
+++ b/ryu/ofproto/ofproto_v1_0_parser.py
@@ -884,6 +884,9 @@ class OFPPacketIn(MsgBase):
             ofproto_v1_0.OFP_PACKET_IN_PACK_STR,
             msg.buf, ofproto_v1_0.OFP_HEADER_SIZE)
         msg.data = msg.buf[ofproto_v1_0.OFP_PACKET_IN_DATA_OFFSET:]
+        if msg.total_len < len(msg.data):
+            # discard padding for 8-byte alignment of OFP packet
+            msg.data = msg.data[:msg.total_len]
         return msg
 
 
-- 
1.7.1.1


------------------------------------------------------------------------------
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