WebAssembly / wasi-sockets

WASI API proposal for managing sockets
236 stars 21 forks source link

Emulate dualstack sockets in userspace #1

Open badeend opened 2 years ago

badeend commented 2 years ago

Dualstack support per platform according to the internet: (Not verified)

On the *BSD's: Can dualstack sockets be emulated efficiently and transparently in userspace by creating two sockets?

tschneidereit commented 2 years ago

@badeend in your assessment, do you think this needs to be part of an MVP? Given that not all OSs support this, maybe we can punt on it and let the emulation happen entirely in userspace, even above libc?

sunfishcode commented 2 years ago

I suggest saying it's "nondeterministic" whether dual-stack is enabled by default or not. This effectively represents the reality most portable socket code today faces, where dual-stack support may or may not be enabled in ways that are outside the application's control or visibility.

Beyond that, it'd be nice (but not necessarily critical for an MVP) to have a way to set IPV6_V6ONLY.

badeend commented 2 years ago

@tschneidereit You're correct in that it doesn't need to be part of the MVP. It currently isn't.

@sunfishcode That's certainly the most pragmatic option. Let me start by saying that I too am on the fence on this one.

The things that made me swing slightly towards IPv6-only by default versus just choosing the underlying platform's default:

sunfishcode commented 2 years ago

That also sounds reasonable to me.

badeend commented 2 years ago

In https://github.com/WebAssembly/wasi-sockets/pull/13 I've added the option to get and set the ipv6-only option. In the documentation of the method I've clarified that dual-stack support is not required from the host.

rwally1986 commented 2 years ago

The underlying commercial operating systems use "prefer IPv6, fail-over to IPv4 by default". The current security best practices with many security teams is "prefer IPv4, fail-over to IPv4 by default". So how does this impact existing software?