janestreet / async_unix

Jane Street Capital's asynchronous execution library (unix)
MIT License
33 stars 21 forks source link

Bind address wrongly set to ipv4 in case of ipv6 #21

Closed LasseBlaauwbroek closed 2 months ago

LasseBlaauwbroek commented 3 years ago

It is not possible to connect to an ipv6 address using Where_to_connect when specifying no bind address. It errors out with Address family not supported by protocol. This seems to happen because create_bind_any always uses ipv4: https://github.com/janestreet/async_unix/blob/cc9687df10b2763943002640856329f5052f0b04/src/unix_syscalls.ml#L650 It should instead detect when ipv6 is used and change the address appropriately.

seliopou commented 2 months ago

We don't currently have any plans to support IPv6 natively in async. This doesn't preclude you from creating a file_descr yourself, and then creating an Fd.t for use with, e.g., Reader.t and/or Writer.t. Unfortunately this approach will break down if you ever use the Fd.t in a module that asks questions about the Fd.t's address family.

It's a big lift and internally, there is not much of a need for it. I understand that this is an unsatisfying answer, but that's where currently at.