diff --git a/tests/hwsim/hwsim.py b/tests/hwsim/hwsim.py index 9300922a8..bc1be8542 100644 --- a/tests/hwsim/hwsim.py +++ b/tests/hwsim/hwsim.py @@ -22,7 +22,7 @@ HWSIM_ATTR_USE_CHANCTX = 15 class HWSimController(object): def __init__(self): self._conn = netlink.Connection(netlink.NETLINK_GENERIC) - self._fid = netlink.genl_controller.get_family_id('MAC80211_HWSIM') + self._fid = netlink.genl_controller.get_family_id(b'MAC80211_HWSIM') def create_radio(self, n_channels=None, use_chanctx=False, use_p2p_device=False): diff --git a/tests/hwsim/netlink.py b/tests/hwsim/netlink.py index eef79090c..eba6102a4 100644 --- a/tests/hwsim/netlink.py +++ b/tests/hwsim/netlink.py @@ -33,7 +33,7 @@ class Attr(object): hdr = struct.pack("HH", len(self._data) + 4, self._type) length = len(self._data) pad = ((length + 4 - 1) & ~3 ) - length - return hdr + self._data + '\0' * pad + return hdr + self._data + b'\x00' * pad def __repr__(self): return '' % (self._type, repr(self._data)) @@ -71,7 +71,7 @@ class U8Attr(Attr): class FlagAttr(Attr): def __init__(self, attr_type): - Attr.__init__(self, attr_type, "") + Attr.__init__(self, attr_type, b"") class Nested(Attr): def __init__(self, attr_type, attrs): @@ -113,10 +113,9 @@ class Message(object): self.pid = -1 payload = payload or [] if isinstance(payload, list): - contents = [] + self.payload = bytes() for attr in payload: - contents.append(attr._dump()) - self.payload = ''.join(contents) + self.payload += attr._dump() else: self.payload = payload