Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DDNS not working with IPv6 #135

Open
rednil opened this issue Jan 25, 2024 · 1 comment
Open

DDNS not working with IPv6 #135

rednil opened this issue Jan 25, 2024 · 1 comment

Comments

@rednil
Copy link

rednil commented Jan 25, 2024

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)

@csoler
Copy link
Contributor

csoler commented Jan 25, 2024

thx for pointing this out. It's actually a bit more complicated since return_addr is of type in_addr which is only valid for IPv4. I'll take a look at this and will keep you posted.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants