Skip to content

DDNS not working with IPv6 #135

@rednil

Description

@rednil

Description

If a DNS lookup returns only an IPv6 record, this IPv6 address is not used for a connection attempt. Instead, libretroshare reports the following:

bool rsGetHostByName(const string&, in_addr&)(EE) getaddrinfo returned error -5 on string "xxx.ddnss.de"
DNSResolver: lookup error for address "xxx.ddnss.de"

nslookup on the same host correctly returns the following (name and numbers changed):

Non-authoritative answer:
Name:	xxx.ddnss.de
Address: 2b02:63e0:20a2:6f51:cd46:face:7435:8985 

This address is reachable from outside, and RetroShare can actually connect to it with some workarounds.

Expected behaviour

RetroShare should attempt to establish a connection to the respective IPv6 address.

Reproduce

On a node that is currently offline, open the "Node Details" and insert a dynamic DNS address that is only updated with IPv6. Observe the console output.

Relevance

I am behind a "carrier grade NAT", so I have no real public IPv4. The IPv4 address used for outbound connections is picked up by RetroShare, even reported by all the "Find My IP" services and prevalent everywhere in RetroShare, but not accessible from outside. This scheme is becoming more and more prevalent with diminishing numbers of available IPv4 addresses. Currently it is very hard for me to connect (although not impossible) due to several bugs (I will open separate issues).

Proposed Solution

In this code line

hint.ai_family = AF_INET;

the "ai_family" (one of AF_INET, AF_INET6 and AF_UNSPEC) is defined as "AF_INET". IMHO it should be defined as AF_UNSPEC and the code should handle both IPv4 and IPv6 addresses (https://man7.org/linux/man-pages/man3/getaddrinfo.3.html)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions