From 4602651b2c18647f71667da7989a5a4edb8e35a2 Mon Sep 17 00:00:00 2001 From: IWASE Yusuke Date: Fri, 15 Dec 2017 10:00:10 +0900 Subject: ofproto_v1_5_parser: Missing trailing pads of OFPActionCopyField OpenFlow Spec 1.5 says OFPActionCopyField has the trailing paddings to make the action a whole multiple of 8 bytes in length. Signed-off-by: IWASE Yusuke Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_5_parser.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py index 1146e5ce..316757da 100644 --- a/ryu/ofproto/ofproto_v1_5_parser.py +++ b/ryu/ofproto/ofproto_v1_5_parser.py @@ -5964,14 +5964,16 @@ class OFPActionCopyField(OFPAction): return cls(n_bits, src_offset, dst_offset, oxm_ids, type_, len_) def serialize(self, buf, offset): - oxm_ids_buf = bytearray() + oxm_ids_buf = b'' for i in self.oxm_ids: oxm_ids_buf += i.serialize() - self.len += len(oxm_ids_buf) + action_len = ofproto.OFP_ACTION_COPY_FIELD_SIZE + len(oxm_ids_buf) + self.len = utils.round_up(action_len, 8) + pad_len = self.len - action_len msg_pack_into(ofproto.OFP_ACTION_COPY_FIELD_PACK_STR, buf, offset, self.type, self.len, self.n_bits, self.src_offset, self.dst_offset) - buf += oxm_ids_buf + buf += oxm_ids_buf + b'\x00' * pad_len @OFPAction.register_action_type(ofproto.OFPAT_METER, -- cgit v1.2.3