diff options
author | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-06-25 15:22:38 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2012-06-26 09:44:07 +0900 |
commit | 6f74ab194a772c9666811985061c2bc107733ef1 (patch) | |
tree | 0feff1107cd18d5722580084ab6ee1099badfca7 | |
parent | 6a647fd6353237ba09a5416115ce5cb4018fefba (diff) |
of1.2: fix OFPPacketIn parser to set ethernet frame
set ethernet frame in msg.data.
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | 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 d9c12fb4..6acf7d23 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 |