Network Membrane
Operational
The Network Membrane is the userland network stack. It runs the grafted LwIP (Lightweight IP) stack inside a sandboxed fiber, providing TCP/IP connectivity to applications through a POSIX-compatible shim.
What Is the Membrane?
The Membrane (libnexus.a) is a compatibility adapter — a "biosuit" that wraps POSIX system calls and routes them through Nexus's sovereign abstractions. For networking, this means:
socket()creates a Membrane-managed endpointconnect()sends a connection request through the LwIP stacksend()/recv()transfer data through ION Ringsbind()/listen()/accept()work as expected
Applications compiled against POSIX (curl, wget, ssh) work through the Membrane without modification. They never touch the kernel's network code directly.
Architecture
┌─────────────────────────┐
│ Application Process │
│ (calls socket/send) │
├─────────────────────────┤
│ Membrane POSIX Shim │ libnexus.a
│ (translates to ION) │
├─────────────────────────┤
│ LwIP TCP/IP Stack │ Grafted, runs as fiber
│ (DHCP, TCP, UDP, ICMP) │
├─────────────────────────┤
│ ION Ring (proc_rx/tx) │ Zero-copy to kernel
├─────────────────────────┤
│ NetSwitch (Kernel) │ L2 demux
└─────────────────────────┘LwIP — The Grafted Stack
LwIP is an open-source lightweight TCP/IP stack designed for embedded systems. Nexus grafts it by:
- Stripping all OS-specific code (no pthreads, no file I/O)
- Replacing the platform layer with ION Ring integration
- Running it as a Rumpk fiber with restricted capabilities
- Applying pledge constraints (INET only — no filesystem access, no process spawning)
The result is a TCP/IP stack that provides full connectivity but cannot escape its sandbox.
DHCP and Network Configuration
The Membrane fiber runs DHCP client logic at boot:
- NetSwitch routes incoming DHCP responses to the Membrane fiber's ION Ring
- LwIP processes the DHCP offer and configures the interface
- The assigned IP address is registered in
/Bus/net/ - Applications can now connect to the network
Why Not a Kernel Network Stack?
Three reasons:
Crash isolation: A bug in TCP processing kills only the Membrane fiber. The kernel restarts it. Applications reconnect.
Attack surface reduction: The kernel's trusted computing base does not include a TCP/IP stack. You cannot exploit a buffer overflow in packet parsing to gain kernel privileges.
Replaceability: The Membrane is a service, not a kernel feature. You can swap LwIP for a different stack, run multiple stacks simultaneously, or remove networking entirely — without recompiling the kernel.
Chimera POSIX Bridge
For full POSIX compatibility, the Membrane includes the Chimera bridge (SPEC-073) — a more complete adaptation layer that handles edge cases:
- Non-blocking I/O (
O_NONBLOCK) - Socket options (
setsockopt) - Signal-driven I/O (
SIGIO) - Unix domain sockets (mapped to local ION Rings)
This bridge makes it possible to graft complex network applications (nginx, PostgreSQL, Node.js) with minimal or no source modifications.