of1.3: fix OFPT_PACKET_IN parser
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
This commit is contained in:
parent
6df14f6ffd
commit
3e98bf7aac
@ -763,10 +763,10 @@ assert (calcsize(OFP_ASYNC_CONFIG_PACK_STR) + OFP_HEADER_SIZE ==
|
||||
OFP_ASYNC_CONFIG_SIZE)
|
||||
|
||||
# struct ofp_packet_in
|
||||
OFP_PACKET_IN_PACK_STR = '!IHBBQ' + _OFP_MATCH_PACK_STR
|
||||
OFP_PACKET_IN_PACK_STR = '!IHBBQ'
|
||||
OFP_PACKET_IN_SIZE = 32
|
||||
OFP_PACKET_IN_DATA_OFFSET = 18
|
||||
assert (calcsize(OFP_PACKET_IN_PACK_STR) + OFP_HEADER_SIZE ==
|
||||
assert (calcsize(OFP_PACKET_IN_PACK_STR) + OFP_MATCH_SIZE + OFP_HEADER_SIZE ==
|
||||
OFP_PACKET_IN_SIZE)
|
||||
|
||||
# enum ofp_packet_in_reason
|
||||
|
@ -1286,8 +1286,17 @@ class OFPPacketIn(MsgBase):
|
||||
ofproto_v1_3.OFP_PACKET_IN_PACK_STR,
|
||||
msg.buf, ofproto_v1_3.OFP_HEADER_SIZE)
|
||||
|
||||
offset = ofproto_v1_3.OFP_HEADER_SIZE + ofproto_v1_3.OFP_PACKET_IN_SIZE
|
||||
msg.match = OFPMatch.parser(buf, offset - ofproto_v1_3.OFP_MATCH_SIZE)
|
||||
msg.match = OFPMatch.parser(msg.buf, ofproto_v1_3.OFP_PACKET_IN_SIZE -
|
||||
ofproto_v1_3.OFP_MATCH_SIZE)
|
||||
|
||||
match_len = utils.round_up(msg.match.length, 8)
|
||||
msg.data = msg.buf[(ofproto_v1_3.OFP_PACKET_IN_SIZE -
|
||||
ofproto_v1_3.OFP_MATCH_SIZE + match_len + 2):]
|
||||
|
||||
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
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user