summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorIWAMOTO Toshihiro <iwamoto@valinux.co.jp>2015-07-03 11:27:07 +0900
committerFUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>2015-07-03 11:38:00 +0900
commite86e8c88b0f1e03b6b530c8995f8dc22a3b5c5bd (patch)
treeed06bd5772056732e027058fa02229ff06163ce2
parent7da17ac94144dcdf264e63da54aa9c0142934e5d (diff)
python3: Use six.indexbytes for extracting single byte of data
Signed-off-by: IWAMOTO Toshihiro <iwamoto@valinux.co.jp> Signed-off-by: FUJITA Tomonori <fujita.tomonori@lab.ntt.co.jp>
-rw-r--r--ryu/lib/packet/bfd.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/ryu/lib/packet/bfd.py b/ryu/lib/packet/bfd.py
index 8818da8e..e12fec5d 100644
--- a/ryu/lib/packet/bfd.py
+++ b/ryu/lib/packet/bfd.py
@@ -80,6 +80,7 @@ BFD Control packet format
import binascii
import hashlib
import random
+import six
import struct
from . import packet_base
@@ -240,7 +241,7 @@ class bfd(packet_base.PacketBase):
flags = flags & 0x3f
if flags & BFD_FLAG_AUTH_PRESENT:
- (auth_type,) = struct.unpack_from('!B', buf[cls._PACK_STR_LEN])
+ auth_type = six.indexbytes(buf, cls._PACK_STR_LEN)
auth_cls = cls._auth_parsers[auth_type].\
parser(buf[cls._PACK_STR_LEN:])[0]
else:
@@ -396,8 +397,7 @@ class SimplePassword(BFDAuth):
(auth_type, auth_len) = cls.parser_hdr(buf)
assert auth_type == cls.auth_type
- (auth_key_id,) = struct.unpack_from(cls._PACK_STR,
- buf[cls._PACK_HDR_STR_LEN])
+ auth_key_id = six.indexbytes(buf, cls._PACK_HDR_STR_LEN)
password = buf[cls._PACK_HDR_STR_LEN + cls._PACK_STR_LEN:auth_len]