set ethernet frame in msg.data.
Signed-off-by: FUJITA Tomonori <[email protected]>
---
ryu/ofproto/ofproto_v1_2_parser.py | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/ryu/ofproto/ofproto_v1_2_parser.py
b/ryu/ofproto/ofproto_v1_2_parser.py
index d9c12fb..6acf7d2 100644
--- a/ryu/ofproto/ofproto_v1_2_parser.py
+++ b/ryu/ofproto/ofproto_v1_2_parser.py
@@ -19,6 +19,7 @@ import struct
import itertools
from ryu.lib import mac
+from ryu import utils
from ofproto_parser import MsgBase, msg_pack_into, msg_str_attr
from . import ofproto_parser
from . import ofproto_v1_2
@@ -236,6 +237,15 @@ class OFPPacketIn(MsgBase):
msg.match = OFPMatch.parser(msg.buf, ofproto_v1_2.OFP_PACKET_IN_SIZE -
ofproto_v1_2.OFP_MATCH_SIZE)
+
+ match_len = utils.round_up(msg.match.length, 8)
+ msg.data = msg.buf[(ofproto_v1_2.OFP_PACKET_IN_SIZE -
+ ofproto_v1_2.OFP_MATCH_SIZE + match_len):]
+
+ 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.4.4
------------------------------------------------------------------------------
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