Skip to content
Snippets Groups Projects
Commit 5374ec9c authored by Erik Reid's avatar Erik Reid
Browse files

use 'subnets:*' to lookup peer addresses

parent b27211f0
No related branches found
No related tags found
No related merge requests found
......@@ -193,12 +193,16 @@ def find_interfaces(address):
:return:
"""
r = common.get_current_redis()
for k in r.keys('reverse_interface_addresses:*'):
info = r.get(k.decode('utf-8')).decode('utf-8')
info = json.loads(info)
interface = ipaddress.ip_interface(info['interface address'])
for k in r.keys('subnets:*'):
k = k.decode('utf-8')
m = re.match(r'^subnets:(.*)$', k)
assert m, 'sanity failure: redis returned an invalid key name'
interface = ipaddress.ip_interface(m.group(1))
if address in interface.network:
yield info
info = r.get(k).decode('utf-8')
info = json.loads(info)
for ifc in info:
yield ifc
def find_interfaces_and_services(address_str):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment