microsocks icon indicating copy to clipboard operation
microsocks copied to clipboard

Trying IPv6 sockets w/ IPv6 being available but down, leads to connection failures

Open erikarn opened this issue 1 year ago • 2 comments

This is ... kinda silly? I'm going to work around it for now by using -b but it would be nice to update socket logic to try different hosts.

The TL;DR is:

  • resolve() returns the host list
  • connect_socks_target() only tries /one/ entry in the list
  • github.com returns only A records
  • freebsd.org git repo IPs return AAAA and A records
  • my interfaces have local v6 addresses but currently (for stupid reasons) no global v6 addresses
  • so, if I try connecting to freebsd.org hosts, it will see AAAA is likely fine, bind() ok, connect() hits "HOST_UNREACHABLE" and bam.

It would be nice if instead it could loop over the hosts returned by getaddrinfo() and try them until one succeeds?

erikarn avatar Apr 09 '24 20:04 erikarn

you could also patch resolve to use either AF_INET or AF_INET6 for hints instead of AF_UNSPEC. the code kinda expects that one has his internet connectivity properly set up. maybe i'll take a look at implementing a loop here, but it's the first time anyone complains.

rofl0r avatar Apr 09 '24 20:04 rofl0r

Yeah, I'm fixing it up right now to try the returned list in a loop. Stay tuned!

(Also yeah I also dislike when internet isn't "properly set up" but somehow I'm not getting a v6 lease, only a v4. I need to go figure THAT out too.) (And yeah, my LAN stuff also has v6 enabled!)

-adrian

Message ID: @.***>

erikarn avatar Apr 10 '24 00:04 erikarn