From 60cfa1d3c5c9fc5b6ffd350db66b5f464d6424d8 Mon Sep 17 00:00:00 2001 From: Jarrod Johnson Date: Tue, 6 Sep 2022 16:40:34 -0400 Subject: [PATCH] Skip peer probe on remote When remote ip is detected, communicate by returning False instead of None. Use this indication to let ssdp skip a transmit and growing pending list in such a case. --- confluent_server/confluent/discovery/protocols/ssdp.py | 4 ++++ confluent_server/confluent/neighutil.py | 4 +++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/confluent_server/confluent/discovery/protocols/ssdp.py b/confluent_server/confluent/discovery/protocols/ssdp.py index 3a3eb49a..937a5312 100644 --- a/confluent_server/confluent/discovery/protocols/ssdp.py +++ b/confluent_server/confluent/discovery/protocols/ssdp.py @@ -189,6 +189,10 @@ def snoop(handler, byehandler=None, protocol=None, uuidlookup=None): continue recent_peers.add(peer) mac = neighutil.get_hwaddr(peer[0]) + if mac == False: + # neighutil determined peer ip is not local, skip attempt + # to probe and critically, skip growing deferrednotifiers + continue if not mac: probepeer = (peer[0], struct.unpack('H', os.urandom(2))[0] | 1025) + peer[2:] try: diff --git a/confluent_server/confluent/neighutil.py b/confluent_server/confluent/neighutil.py index 5841f868..de0d3ff2 100644 --- a/confluent_server/confluent/neighutil.py +++ b/confluent_server/confluent/neighutil.py @@ -97,7 +97,9 @@ def get_hwaddr(ipaddr): _update_neigh() updated = True hwaddr = neightable.get(ipaddr, None) - if not hwaddr and not updated and netutil.ip_is_local(ipaddr): + if not hwaddr and not netutil.ip_is_local(ipaddr): + hwaddr = False + if hwaddr == None and not updated: _update_neigh() hwaddr = neightable.get(ipaddr, None) if hwaddr: