diff options
author | IWASE Yusuke <iwase.yusuke0@gmail.com> | 2017-12-15 10:00:10 +0900 |
---|---|---|
committer | FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp> | 2017-12-17 19:27:33 +0900 |
commit | 4602651b2c18647f71667da7989a5a4edb8e35a2 (patch) | |
tree | 030b67f3839223b06fc4c873639708ff75512144 | |
parent | aa9f3f483c6b437e47f17de69dafd0d997a119cc (diff) |
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 <iwase.yusuke0@gmail.com>
Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r-- | ryu/ofproto/ofproto_v1_5_parser.py | 8 |
1 files 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, |