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

Unable to connect to the ZeroTierOne service HTTP API via IPv4 #2342

Open
alexrsagen opened this issue Aug 13, 2024 · 3 comments · May be fixed by #2343
Open

Unable to connect to the ZeroTierOne service HTTP API via IPv4 #2342

alexrsagen opened this issue Aug 13, 2024 · 3 comments · May be fixed by #2343

Comments

@alexrsagen
Copy link

What you expect to be happening.

Should be able to connect to http://127.0.0.1:9993 (IPv4).

What is actually happening?

Any steps to reproduce the error.

Any relevant console output or screenshots.

C:\Windows\System32>whoami
nt-myndighet\system

C:\Windows\System32>netstat -a -o -n | findstr 9993 | findstr LISTENING
  TCP    0.0.0.0:9993           0.0.0.0:0              LISTENING       57760
  TCP    0.0.0.0:9993           0.0.0.0:0              LISTENING       57760
  TCP    [::]:9993              [::]:0                 LISTENING       57760

C:\Windows\System32>netstat -a -o -n | findstr 9993 | findstr UDP
  UDP    192.168.111.146:9993   *:*                                    57760
  UDP    192.168.111.155:9993   *:*                                    57760

C:\Windows\System32>tasklist | findstr 57760
zerotier-one_x64.exe         57760 Services                   0     13 520 K

C:\Windows\System32>powershell -command "Test-NetConnection -ComputerName 127.0.0.1 -Port 9993"
WARNING: TCP connect to (127.0.0.1 : 9993) failed

ComputerName           : 127.0.0.1
RemoteAddress          : 127.0.0.1
RemotePort             : 9993
InterfaceAlias         : Loopback Pseudo-Interface 1
SourceAddress          : 127.0.0.1
PingSucceeded          : True
PingReplyDetails (RTT) : 0 ms
TcpTestSucceeded       : False

C:\Windows\System32>powershell -command "Test-NetConnection -ComputerName '::1' -Port 9993"

ComputerName     : ::1
RemoteAddress    : ::1
RemotePort       : 9993
InterfaceAlias   : Loopback Pseudo-Interface 1
SourceAddress    : ::1
TcpTestSucceeded : True

C:\Windows\System32>powershell -command "test-netconnection -computername localhost -port 9993"

ComputerName     : localhost
RemoteAddress    : ::1
RemotePort       : 9993
InterfaceAlias   : Loopback Pseudo-Interface 1
SourceAddress    : ::1
TcpTestSucceeded : True

What operating system and ZeroTier version. Please try the latest ZeroTier release.

Windows 11 Business, build 10.0.22631.

ZeroTierOne version 1.14.0.

@laduke
Copy link
Contributor

laduke commented Aug 13, 2024

similar symptoms to #2151

@alexrsagen
Copy link
Author

alexrsagen commented Aug 13, 2024

I may have identified the cause while reading through #2151... Correct me if I'm wrong, but this is my current assumption:

yhirose/cpp-httplib@b2203bb sets IPV6_V6ONLY to "no", making the IPv6 socket bind to both IPv4 and IPv6, leaving the IPv4 socket (or the IPv4 part of the IPv6 dual-stack socket?) unable to bind, as mentioned here.

ZeroTierOne explicitly binds to both IPv4 and IPv6, this is not valid while the IPV6_V6ONLY flag is set to "no".

To resolve the issue, ZeroTierOne should either:

  • not utilize a dual-stack IPv6 socket (by explicitly setting IPV6_V6ONLY to "yes")
  • only bind to a single dual-stack IPv6 socket (by removing the IPv4 bind)

@yhirose
Copy link

yhirose commented Sep 1, 2024

@alexrsagen I am an author of cpp-httplib, and I happened to find this issue. I made a change to allow users to adjust this socket behavior.

You can adjust the behavior with either CPPHTTPLIB_IPV6_V6ONLY processor macro, or set_ipv6_v6only method.
This change is included in v0.17.0. Hope it helps!

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

Successfully merging a pull request may close this issue.

3 participants