diff --git a/src/yunohost/dyndns.py b/src/yunohost/dyndns.py index e33cf4f22..2ded9909e 100644 --- a/src/yunohost/dyndns.py +++ b/src/yunohost/dyndns.py @@ -257,13 +257,17 @@ def dyndns_update( def resolve_domain(domain, rdtype): - # FIXME make this work for IPv6-only hosts too.. ok, result = dig(dyn_host, "A") - dyn_host_ip = result[0] if ok == "ok" and len(result) else None - if not dyn_host_ip: - raise YunohostError("Failed to resolve %s" % dyn_host, raw_msg=True) + dyn_host_ipv4 = result[0] if ok == "ok" and len(result) else None + if not dyn_host_ipv4: + raise YunohostError("Failed to resolve IPv4 for %s ?" % dyn_host, raw_msg=True) + + ok, result = dig(dyn_host, "AAAA") + dyn_host_ipv6 = result[0] if ok == "ok" and len(result) else None + if not dyn_host_ipv6: + raise YunohostError("Failed to resolve IPv6 for %s ?" % dyn_host, raw_msg=True) - ok, result = dig(domain, rdtype, resolvers=[dyn_host_ip]) + ok, result = dig(domain, rdtype, resolvers=[dyn_host_ipv4, dyn_host_ipv6]) if ok == "ok": return result[0] if len(result) else None elif result[0] == "Timeout":