-
Notifications
You must be signed in to change notification settings - Fork 22
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
What's in a socket? #44
Comments
I don't worry too much about the (historic & broader) definition of a "socket" and what it is "supposed" to do. Rather, I focus on: How can we provide a WASI native interface that provides internet connectivity to applications in such a way that the majority of real-world existing BSDSocket applications need little to no modifications. |
alright. do you think a compositional socket model would be appropriate for wasi? you ever think about how TCP and UDP are the only transport protocols and get upset that something like SCTP could never be implemented? personally we think our ideal socket approach would be having tcp/ipv4, tcp/ipv6, etc sockets fully separate. kinda like a microkernel, with each network layer being its own userspace daemon. or at least, being able to pretend it is. that way, sctp would be simply another userspace daemon. e.g. the IPv6 layer would take IPv6 packets, find the type (tcp vs udp vs sctp, effectively a service identifier), and forward that to the appropriate userspace daemon, and the sctp/ipv6 daemon would take that packet, look at the port number (which is another service identifier), and forward that to the appropriate userspace app. we think exposing something like this instead of the traditional BSD sockets would be pretty neat. but wasm being wasm, we can use function calls instead of unix sockets to communicate between the application and the userspace daemon. in fact there wouldn't be an userspace daemon in practice. since the tcp daemon would wrap the ipv6 stuff and you'd use it as a tcp/ipv6 daemon, wasi could just expose separate tcp/ipv6 and udp/ipv6 interfaces and maybe define a composition-based design pattern if someone ever wants to provide sctp to wasm. (in other words... wasi-socket should not only provide tcp/ipv6 and udp/ipv6, but also a design pattern for future transport protocols and even raw sockets.) |
This modularization already exists to some degree. This proposal includes UDP & TCP as fully independent interfaces. Additionally, there nothing stopping a future proposal from adding a third separate interface for SCTP, and a fourth for RAW sockets, etc. From the README:
You mention tcp/ipv4 and tcp/ipv6 existing as separate modules. I did tinker with this idea too, but ultimately didn't think it was worth it;
|
ah yeah. we mean, in a real microkernel you'd have a single tcp daemon, so dualstack sockets would still work fine there. but yeah. |
Is there anything else you wanted to discuss? |
not particularly. we still think it's important to look back on existing implementations and understand their pain points and where they break down, but yeah we think that's about all there is to it really. we don't know tho. maybe there's more stuff we haven't considered? |
Apologies for the uh, vague issue, but not sure of a better way to do this. We want fairly open-ended discussion about what a socket is. A starting point might be to look at how different existing systems handle sockets - say, BSD vs microkernels, and how that affects things like socket options. Or indeed existing sandboxing attempts.
Personally we don't have any resources on hand about this stuff but opening an issue is a good way to get poked about looking into it. :v
The text was updated successfully, but these errors were encountered: