From a3e00682ab4915fd9137977cac1cabe2ebfac7a4 Mon Sep 17 00:00:00 2001 From: Masashi Honma Date: Thu, 31 Jan 2019 17:15:43 +0900 Subject: [PATCH] tests: nl80211 attr with python3 compatible version Update nl80211 attribute building helpers to not depend on python2 implicit conversions. Signed-off-by: Masashi Honma --- tests/hwsim/nl80211.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/hwsim/nl80211.py b/tests/hwsim/nl80211.py index 910381639..08fae834a 100644 --- a/tests/hwsim/nl80211.py +++ b/tests/hwsim/nl80211.py @@ -322,7 +322,7 @@ nl80211_attr = { def build_nl80211_attr(id, val): attr = struct.pack("@HH", 4 + len(val), nl80211_attr[id]) + val if len(attr) % 4 != 0: - attr += '\0' * (4 - (len(attr) % 4)) + attr += b'\x00' * (4 - (len(attr) % 4)) return attr def build_nl80211_attr_u32(id, val): @@ -335,7 +335,7 @@ def build_nl80211_attr_u8(id, val): return build_nl80211_attr(id, struct.pack("@B", val)) def build_nl80211_attr_flag(id): - return build_nl80211_attr(id, '') + return build_nl80211_attr(id, b'') def build_nl80211_attr_mac(id, val): addr = struct.unpack('6B', binascii.unhexlify(val.replace(':','')))