Changeset View
Changeset View
Standalone View
Standalone View
test/functional/test_framework/netutil.py
Show First 20 Lines • Show All 109 Lines • ▼ Show 20 Lines | while True: | ||||
s.fileno(), | s.fileno(), | ||||
0x8912, # SIOCGIFCONF | 0x8912, # SIOCGIFCONF | ||||
struct.pack('iL', bytes, names.buffer_info()[0]) | struct.pack('iL', bytes, names.buffer_info()[0]) | ||||
))[0] | ))[0] | ||||
if outbytes == bytes: | if outbytes == bytes: | ||||
max_possible *= 2 | max_possible *= 2 | ||||
else: | else: | ||||
break | break | ||||
namestr = names.tostring() | namestr = names.tobytes() | ||||
return [(namestr[i:i + 16].split(b'\0', 1)[0], | return [(namestr[i:i + 16].split(b'\0', 1)[0], | ||||
socket.inet_ntoa(namestr[i + 20:i + 24])) | socket.inet_ntoa(namestr[i + 20:i + 24])) | ||||
for i in range(0, outbytes, struct_size)] | for i in range(0, outbytes, struct_size)] | ||||
def addr_to_hex(addr): | def addr_to_hex(addr): | ||||
''' | ''' | ||||
Convert string IPv4 or IPv6 address to binary address as returned by | Convert string IPv4 or IPv6 address to binary address as returned by | ||||
▲ Show 20 Lines • Show All 42 Lines • Show Last 20 Lines |