2
0
mirror of https://github.com/xcat2/confluent.git synced 2026-10-20 14:45:45 +00:00

Pass the address family and type to getaddrinfo by keyword

The loop resolver takes only host and port positionally, so these three calls
raised "BaseEventLoop.getaddrinfo() takes 3 positional arguments but 5 were
given" every time they ran.

get_ipaddr and _find_service have no handler above them, so link local XCC
discovery and a targeted SSDP search both died outright. The snoop copy sits
under an except Exception, which swallowed it and left the MGTIFACE reply
unanswered instead.
This commit is contained in:
Markus Hilger
2026-08-10 23:50:24 +02:00
parent 1a4475f64e
commit a325f65076
2 changed files with 4 additions and 3 deletions
@@ -64,7 +64,7 @@ class NodeHandler(immhandler.NodeHandler):
if lla:
for idx in util.list_interface_indexes():
tmplla = '{0}%{1}'.format(lla, idx)
addr = (await cloop.getaddrinfo(tmplla, 443, 0, socket.SOCK_STREAM))[0][4]
addr = (await cloop.getaddrinfo(tmplla, 443, type=socket.SOCK_STREAM))[0][4]
try:
tsock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
tsock.setblocking(0)
@@ -329,7 +329,8 @@ async def snoop(handler, byehandler=None, protocol=None, uuidlookup=None):
if await netutil.ip_on_same_subnet(theip, 'fe80::', 64):
if '%' in peer[0]:
ifidx = peer[0].split('%', 1)[1]
iface = (await cloop.getaddrinfo(peer[0], 0, socket.AF_INET6, socket.SOCK_DGRAM))[0][-1][-1]
iface = (await cloop.getaddrinfo(peer[0], 0, family=socket.AF_INET6,
type=socket.SOCK_DGRAM))[0][-1][-1]
else:
ifidx = '{}'.format(peer[-1])
iface = peer[-1]
@@ -390,7 +391,7 @@ async def _find_service(service, target):
cloop.add_reader(net4, _relay_pkt, net4, pktq)
cloop.add_reader(net6, _relay_pkt, net6, pktq)
if target:
addrs = await cloop.getaddrinfo(target, 1900, 0, socket.SOCK_DGRAM)
addrs = await cloop.getaddrinfo(target, 1900, type=socket.SOCK_DGRAM)
for addr in addrs:
host = addr[4][0]
if addr[0] == socket.AF_INET: