iotaledger / iri

IOTA Reference Implementation
Other
1.15k stars 370 forks source link

Hostname Resolution for FQDN with BOTH IPv4 and IPv6 is not working for IPv6-Nodes #1581

Open MaKla89 opened 5 years ago

MaKla89 commented 5 years ago

Bug description

Pretty much this closed ticket: https://github.com/iotaledger/iri/issues/251

When operating an IPv6-only node, IRI will not be able to connect to FQDN's that resolve to BOTH IPv4 AND IPv6. It will only assume the provided IPv4-address and ignore the IPv6-entry, even if DOCKER_JAVA_NET_PREFER_IPV4_STACK=false is set.

IRI version

1.8.1

Hardware Spec

Intel NUC J3455 Quadcore, 8 GB RAM, SSD

Steps To Reproduce

  1. Add an ipv6-neighbor with his FQDN (make sure the neighbors FQDN resolves to both an ipv4 and an ipv6 address)
  2. See that IRI is not even trying the ipv6-address provided by host-resolution
  3. Connection to neighbor will never be established

Expected behaviour

either try both provided IP-adresses or make an option about PREFERING ipv6-host-resoltuions over ipv4 (for nodes that do have ONLY an ipv6-address)

Actual behaviour

IRI drops the ipv6-host-resolution and only tries ipv4.

nuriel77 commented 5 years ago

Did you try -Djava.net.preferIPv6Addresses=true? Note that the current entrypoint of IRI only supports a number of options. In order to add other options you might need to override the default entrypoint. To test the above suggestion and override the entrypoint you could trying running the entire docker command on the command line. Override entrypoint using the sytnax/cli option --entrypoint=/path/to/override/entrypoint.sh If you need further help you can contact me on discord to try this ...

jakubcech commented 5 years ago

@MaKla89 did you please try the above? :) If that resolves your situation.

MaKla89 commented 5 years ago

@jakubcech : will be done as soon as I have a bit of spare time and get one of my neighbors ready for testing, might be today :)

jakubcech commented 5 years ago

Thanks!

MaKla89 commented 5 years ago

Together with Nuriel we created two test-scenarios today. Each scenario included one ipv6-only node and one node that has both ipv4 and ipv6 addresses. Their connection is working fine when we enter hostnames that only resolve to ipv6-addresses. As soon as we entered hostnames that resolved to an ipv6 AND an ipv4 address, connection could not be established by IRI. It seems (this is a guess) that IRI just accepts the ipv4 result if there is one. No matter if you add -Djava.net.preferIPv6Addresses=true or not.

Maybe this is rather a feature request (Feature = optionally prefer ipv6-addresses is available OR: Try all resolved addresses instead only the first one)