From f16daa44dd8b74a91b7330ee0602285075ee3a96 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Wed, 19 Jul 2023 16:04:25 -0400 Subject: [PATCH] Handle older python with addrinfo While newer python omits '%', older python includes. Change to handle either form. --- confluent_server/confluent/discovery/protocols/ssdp.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/protocols/ssdp.py b/confluent_server/confluent/discovery/protocols/ssdp.py index 3b225759..3c1edc74 100644 --- a/confluent_server/confluent/discovery/protocols/ssdp.py +++ b/confluent_server/confluent/discovery/protocols/ssdp.py @@ -258,7 +258,8 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None): seconds = int(currtime) msecs = int(currtime * 1000 % 1000) reply = 'HTTP/1.1 200 OK\r\nNODENAME: {0}\r\nCURRTIME: {1}\r\nCURRMSECS: {2}\r\n'.format(node, seconds, msecs) - if netutil.ip_on_same_subnet(peer[0], 'fe80::', 64): + theip = peer[0].split('%', 1)[0] + if netutil.ip_on_same_subnet(theip, 'fe80::', 64): if '%' in peer[0]: ifidx = peer[0].split('%', 1)[1] iface = socket.getaddrinfo(peer[0], 0, socket.AF_INET6, socket.SOCK_DGRAM)[0][-1][-1]