From be1b802c0709f7428b7c0702af6b466702ee4680 Mon Sep 17 00:00:00 2001 From: Yusuke Iwase Date: Mon, 3 Aug 2015 14:30:10 +0900 Subject: [PATCH] ofproto_v1_5_parser: Use b'str' for binary data Note: ofproto_v1_[034]_parser was done in previous commits. Signed-off-by: IWASE Yusuke Signed-off-by: FUJITA Tomonori --- ryu/ofproto/ofproto_v1_5_parser.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/ryu/ofproto/ofproto_v1_5_parser.py b/ryu/ofproto/ofproto_v1_5_parser.py index ecd0f9b3..413531c1 100644 --- a/ryu/ofproto/ofproto_v1_5_parser.py +++ b/ryu/ofproto/ofproto_v1_5_parser.py @@ -2065,7 +2065,7 @@ class OFPPort(StringifyMixin): (port_no, length, hw_addr, name, config, state) = struct.unpack_from( ofproto.OFP_PORT_PACK_STR, buf, offset) hw_addr = addrconv.mac.bin_to_text(hw_addr) - name = name.rstrip('\0') + name = name.rstrip(b'\0') props = [] rest = buf[offset + ofproto.OFP_PORT_SIZE:offset + length] while rest: @@ -2325,7 +2325,7 @@ class OFPDescStats(ofproto_parser.namedtuple('OFPDescStats', ( desc = struct.unpack_from(ofproto.OFP_DESC_PACK_STR, buf, offset) desc = list(desc) - desc = [x.rstrip('\0') for x in desc] + desc = [x.rstrip(b'\0') for x in desc] stats = cls(*desc) stats.length = ofproto.OFP_DESC_SIZE return stats @@ -2421,7 +2421,7 @@ class OFPTableFeaturesStats(StringifyMixin): table_features.max_entries ) = struct.unpack_from(ofproto.OFP_TABLE_FEATURES_PACK_STR, buf, offset) - table_features.name = name.rstrip('\0') + table_features.name = name.rstrip(b'\0') props = [] rest = buf[offset + ofproto.OFP_TABLE_FEATURES_SIZE: