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):
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 '<Attr type %d, data "%s">' % (self._type, repr(self._data))
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):
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