From 2cc7d966a000c47cbfba9d0b31bccea1d5ed1f4f Mon Sep 17 00:00:00 2001 From: Gilles Grandou Date: Sat, 5 Oct 2019 23:01:08 +0200 Subject: [PATCH] fix ipv6 sysbus request --- dyndomain | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/dyndomain b/dyndomain index ac87c83..8dce999 100755 --- a/dyndomain +++ b/dyndomain @@ -44,15 +44,19 @@ def ping(hostname): return 0 if ret.returncode else 1 def get_ipv6_hosts(): - r = sysbus.requete('Hosts:getDevices') + r = sysbus.requete('Devices:get') ipv6_hosts = dict() - for host in r['status']: - hostname=host['hostName'] - for addr in host['addresses']: - ipv6_hosts[hostname] = [] - if addr['family'] == 'IPv6' and addr['scope'] == 'global': - ipv6_hosts[hostname].append(addr['ipAddress']) + for h in r['status']: + if not 'IPv6Address' in h or not h['IPv6Address']: + continue + hostname = h['Name'] + for a in h['IPv6Address']: + if a['Scope'] != 'global' or a['Status'] != 'reachable': + continue + if not hostname in ipv6_hosts: + ipv6_hosts[hostname] = [] + ipv6_hosts[hostname].append(a['Address']) return ipv6_hosts